antoniorached commited on
Commit
65b16f5
·
verified ·
1 Parent(s): 80e17cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -4,12 +4,13 @@ import gradio as gr
4
  pipe = pipeline("sentiment-analysis")
5
 
6
  def get_sentiment(input):
7
- return pipe(input)
 
8
 
9
  demo = gr.Interface(
10
  fn=get_sentiment,
11
  inputs="text",
12
- outputs=["text"],
13
  title="Sentiment Analysis",
14
  description="Get a sentimental analysis for the provided text"
15
  )
 
4
  pipe = pipeline("sentiment-analysis")
5
 
6
  def get_sentiment(input):
7
+ prediction = pipe(input)
8
+ return f'{prediction[0].label} {prediction[0].score * 100}'
9
 
10
  demo = gr.Interface(
11
  fn=get_sentiment,
12
  inputs="text",
13
+ outputs="text",
14
  title="Sentiment Analysis",
15
  description="Get a sentimental analysis for the provided text"
16
  )