nadzo commited on
Commit
d0d90ca
·
verified ·
1 Parent(s): ce80c88

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
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()