Bikas0 commited on
Commit
82da92f
1 Parent(s): 0eda64e

update code

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -40,6 +40,8 @@ target_list = ['price', 'packaging', 'product', 'rider', 'delivery', 'shelf', 's
40
 
41
  @app.route('/', methods=['GET', 'POST'])
42
  def index():
 
 
43
  if request.method == 'POST':
44
  raw_text = request.form['text']
45
 
@@ -70,10 +72,8 @@ def index():
70
  # Determine predicted labels based on threshold
71
  predictions = [target_list[idx] for idx, p in enumerate(output) if p == 1]
72
 
73
- return render_template('index.html', text=raw_text, predictions=predictions)
74
-
75
- # For GET request or initial page load
76
- return render_template('index.html')
77
 
78
  if __name__ == '__main__':
79
  app.run(debug=True)
 
 
40
 
41
  @app.route('/', methods=['GET', 'POST'])
42
  def index():
43
+ raw_text = ""
44
+ predictions = []
45
  if request.method == 'POST':
46
  raw_text = request.form['text']
47
 
 
72
  # Determine predicted labels based on threshold
73
  predictions = [target_list[idx] for idx, p in enumerate(output) if p == 1]
74
 
75
+ return render_template('index.html', text=raw_text, predictions=predictions)
 
 
 
76
 
77
  if __name__ == '__main__':
78
  app.run(debug=True)
79
+