saintyboy commited on
Commit
7805bd4
1 Parent(s): e23d41d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the sentiment analysis model
5
+ classifier = pipeline('sentiment-analysis')
6
+
7
+ def sentiment_analysis(text):
8
+ result = classifier(text)
9
+ return result[0]['label'], result[0]['score']
10
+
11
+ # Create a Gradio interface
12
+ demo = gr.Interface(fn=sentiment_analysis, inputs="text", outputs=["text", "number"])
13
+
14
+ # Launch the Gradio app
15
+ demo.launch()