Spaces:
Runtime error
Runtime error
Commit
·
1ff8dbd
1
Parent(s):
726d8ee
sentence
Browse files
main.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import os
|
2 |
-
from flask import Flask, jsonify
|
3 |
from flask_cors import CORS
|
4 |
from transformers import pipeline
|
5 |
|
@@ -19,10 +19,11 @@ def hello():
|
|
19 |
|
20 |
@app.route('/analyze', methods=['GET'])
|
21 |
def analyze():
|
22 |
-
sentence =
|
23 |
result = sentiment_analyzer(sentence)
|
24 |
print(result)
|
25 |
return jsonify(result)
|
26 |
|
|
|
27 |
if __name__ == '__main__':
|
28 |
app.run(debug=True)
|
|
|
1 |
import os
|
2 |
+
from flask import Flask, jsonify, request
|
3 |
from flask_cors import CORS
|
4 |
from transformers import pipeline
|
5 |
|
|
|
19 |
|
20 |
@app.route('/analyze', methods=['GET'])
|
21 |
def analyze():
|
22 |
+
sentence = request.args.get('sentence', default='hey there', type=str)
|
23 |
result = sentiment_analyzer(sentence)
|
24 |
print(result)
|
25 |
return jsonify(result)
|
26 |
|
27 |
+
|
28 |
if __name__ == '__main__':
|
29 |
app.run(debug=True)
|