kumar989 commited on
Commit
3a96c51
·
1 Parent(s): caf7e32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -3,8 +3,13 @@ import gradio as gr
3
  sentiment_analysis = pipeline("sentiment-analysis",model="siebert/sentiment-roberta-large-english")
4
  # print(sentiment_analysis("I love this!"))
5
  def model(a):
6
- return sentiment_analysis(a)[0]
7
- demo = gr.Interface(fn=model, inputs="text", outputs=gr.Label(num_top_classes=2))
 
 
 
 
 
8
  demo.launch()
9
  # import gradio as gr
10
 
 
3
  sentiment_analysis = pipeline("sentiment-analysis",model="siebert/sentiment-roberta-large-english")
4
  # print(sentiment_analysis("I love this!"))
5
  def model(a):
6
+ x=sentiment_analysis(a)[0]
7
+ if x['label']=='POSITIVE':
8
+ d={x['label']:x['score'],'NEGATIVE':1-x['score']}
9
+ else:
10
+ d={'POSITIVE':1-x['score'],x['label']:x['score']}
11
+ return d
12
+ demo = gr.Interface(fn=model, inputs="text", outputs="label")
13
  demo.launch()
14
  # import gradio as gr
15