Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|