HawkeyeHS commited on
Commit
990be7e
·
1 Parent(s): 9fdc2d8

Fixed error

Browse files
Files changed (1) hide show
  1. app.py +7 -2
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
- # @app.route('/sentiment',methods=['POST'])
62
- # def sentiment():
 
 
 
 
 
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"])