Preetham04 commited on
Commit
144af8f
1 Parent(s): 6510d68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -5,7 +5,13 @@ pipeline = pipeline(task="text-classification", model="Preetham04/sentiment-anal
5
 
6
  def predict(input_text):
7
  predictions = pipeline(input_text)
8
- return {p["label"]: p["score"] for p in predictions}
 
 
 
 
 
 
9
 
10
  gradio_app = gr.Interface(
11
  predict,
 
5
 
6
  def predict(input_text):
7
  predictions = pipeline(input_text)
8
+ for p in predictions:
9
+ review = "POSITIVE" if p["label"] == "LABEL_1" else "NEGATIVE"
10
+ result.append({
11
+ "review": review,
12
+ "score": p["score"]
13
+ })
14
+ return input_text, result
15
 
16
  gradio_app = gr.Interface(
17
  predict,