Spaces:
Runtime error
Runtime error
added main file
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
sentiment = pipeline("sentiment-analysis")
|
6 |
+
|
7 |
+
|
8 |
+
def sentiment_analysis(text):
|
9 |
+
|
10 |
+
results = sentiment(text)
|
11 |
+
|
12 |
+
return results[0]["label"], round(results[0]["score"], 5)
|
13 |
+
|
14 |
+
demo = gr.Interface(
|
15 |
+
fn = sentiment_analysis,
|
16 |
+
inputs=gr.Textbox(lines=2, placeholder="Here...", label= 'Enter Text to Classify here'),
|
17 |
+
outputs=[
|
18 |
+
gr.Textbox(label = 'status'),
|
19 |
+
gr.Textbox(label = 'score')
|
20 |
+
]
|
21 |
+
)
|
22 |
+
demo.launch()
|