Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
|
@@ -9,15 +9,15 @@ app = Flask(__name__)
|
|
| 9 |
def index():
|
| 10 |
if request.method == 'POST':
|
| 11 |
keyword = request.form['keyword']
|
|
|
|
| 12 |
|
| 13 |
-
comments = collect_data(keyword)
|
| 14 |
sentiments = predict(comments[:100])
|
| 15 |
|
| 16 |
counts = Counter(sentiments)
|
| 17 |
-
|
| 18 |
data = list(zip(comments[:100], sentiments))
|
| 19 |
|
| 20 |
-
return render_template("result.html", data=data, counts=counts)
|
| 21 |
|
| 22 |
return render_template("index.html")
|
| 23 |
|
|
|
|
| 9 |
def index():
|
| 10 |
if request.method == 'POST':
|
| 11 |
keyword = request.form['keyword']
|
| 12 |
+
source = request.form['source']
|
| 13 |
|
| 14 |
+
comments = collect_data(keyword, source)
|
| 15 |
sentiments = predict(comments[:100])
|
| 16 |
|
| 17 |
counts = Counter(sentiments)
|
|
|
|
| 18 |
data = list(zip(comments[:100], sentiments))
|
| 19 |
|
| 20 |
+
return render_template("result.html", data=data, counts=counts, source=source)
|
| 21 |
|
| 22 |
return render_template("index.html")
|
| 23 |
|