Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,13 @@ import gradio as gr
|
|
| 4 |
pipe = pipeline("sentiment-analysis")
|
| 5 |
|
| 6 |
def get_sentiment(input):
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
demo = gr.Interface(
|
| 10 |
fn=get_sentiment,
|
| 11 |
inputs="text",
|
| 12 |
-
outputs=
|
| 13 |
title="Sentiment Analysis",
|
| 14 |
description="Get a sentimental analysis for the provided text"
|
| 15 |
)
|
|
|
|
| 4 |
pipe = pipeline("sentiment-analysis")
|
| 5 |
|
| 6 |
def get_sentiment(input):
|
| 7 |
+
prediction = pipe(input)
|
| 8 |
+
return f'{prediction[0].label} {prediction[0].score * 100}'
|
| 9 |
|
| 10 |
demo = gr.Interface(
|
| 11 |
fn=get_sentiment,
|
| 12 |
inputs="text",
|
| 13 |
+
outputs="text",
|
| 14 |
title="Sentiment Analysis",
|
| 15 |
description="Get a sentimental analysis for the provided text"
|
| 16 |
)
|