Spaces:
Sleeping
Sleeping
Fixed error
Browse files
app.py
CHANGED
@@ -58,8 +58,13 @@ genai.configure(api_key=api_key)
|
|
58 |
model=genai.GenerativeModel('gemini-pro')
|
59 |
sentiment_analysis = pipeline("sentiment-analysis",model="siebert/sentiment-roberta-large-english")
|
60 |
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
|
65 |
# @app.route("/predict", methods=["GET"])
|
|
|
58 |
model=genai.GenerativeModel('gemini-pro')
|
59 |
sentiment_analysis = pipeline("sentiment-analysis",model="siebert/sentiment-roberta-large-english")
|
60 |
|
61 |
+
@app.route('/sentiment',methods=['POST'])
|
62 |
+
def sentiment():
|
63 |
+
review=request.get_json()['review']
|
64 |
+
if sentiment_analysis(review)[0]['label']=='POSITIVE':
|
65 |
+
return json.dumps({"sentiment":1})
|
66 |
+
else:
|
67 |
+
return json.dumps({"message":0})
|
68 |
|
69 |
|
70 |
# @app.route("/predict", methods=["GET"])
|