Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
sentiment_pipeline = pipeline("sentiment-analysis")
|
5 |
+
|
6 |
+
def analyze(text):
|
7 |
+
result = sentiment_pipeline(text)[0]
|
8 |
+
return f"Label: {result['label']}, Score: {result['score']:.2f}"
|
9 |
+
|
10 |
+
gr.Interface(fn=analyze, inputs="text", outputs="text").launch()
|