akuysal commited on
Commit
476b6fc
1 Parent(s): 080ae89

Sentiment analysis step is corrected

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -1,17 +1,15 @@
1
- # gradio demo
2
  import gradio as gr
3
- from transformers import pipeline
4
 
5
- pipe = pipeline("sentiment-analysis")
6
 
7
- def predict(text):
8
- return pipe(text)[0]["label"]
9
 
10
- iface = gr.Interface(
11
- fn=predict,
12
- inputs='text',
13
- outputs='text',
14
- examples=[["The movie was amazing"]]
15
- )
16
 
17
- iface.launch()
 
 
 
 
 
 
 
1
  import gradio as gr
 
2
 
3
+ from transformers import pipeline
4
 
5
+ sentiment = pipeline("sentiment-analysis")
 
6
 
7
+ def get_sentiment(input_text):
8
+ return sentiment(input_text)
 
 
 
 
9
 
10
+ iface = gr.Interface(fn = get_sentiment,
11
+ inputs = "text",
12
+ outputs = ['text'],
13
+ title = 'Sentiment Analysis',
14
+ description = "Get sentiment Negative/Positive for the given input")
15
+ iface.launch(inline = False)