thak123 commited on
Commit
e710478
·
1 Parent(s): 1435b8d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+
5
+ sentiment = pipeline('sentiment-analysis',)
6
+
7
+ def get_sentiment(input_text):
8
+ result = sentiment(input_text)
9
+ return f"result: {result[0]['label']}", f"score: {result[0]['score']}"
10
+
11
+ interface = gr.Interface(
12
+ fn=get_sentiment,
13
+ inputs='text',
14
+ outputs=['text', 'text'],
15
+ title='Sentiment Analysis',
16
+ description='Get the positive/negative sentiment for the given input.'
17
+ )
18
+
19
+
20
+ interface.launch(inline = False)