arnabmaj commited on
Commit
b4b7edb
·
verified ·
1 Parent(s): 839736d

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"{result['label']} ({result['score']:.2f})"
9
+
10
+ gr.Interface(fn=analyze, inputs="text", outputs="text", title="Sentiment Analyzer").launch()