Jerimee commited on
Commit
8b6d8ff
β€’
1 Parent(s): 4576f6d

copy of Amrrs

Browse files

https://huggingface.co/spaces/Amrrs/gradio-sentiment-analyzer/blob/main/app.py

Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,16 +1,16 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- pipe = pipeline("sentiment-analysis")
5
 
6
- def senti(sentiment):
7
- return pipe(text)
8
 
9
  if __name__ == "__main__":
10
  iface = gr.Interface(
11
- fn=senti,
12
- inputs= gr.inputs.Textbox(lines=3, placeholder="Insert sentiment"),
 
13
  description = 'Get Sentiment Negative/positive for the given input',
14
- outputs="text"
15
  )
16
- iface.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ sentiment = pipeline("sentiment-analysis")
5
 
6
+ def get_sentiment(input_text):
7
+ return sentiment(input_text)
8
 
9
  if __name__ == "__main__":
10
  iface = gr.Interface(
11
+ inputs = "text",
12
+ outputs = ['text'],
13
+ title = 'Sentiment Analysis',
14
  description = 'Get Sentiment Negative/positive for the given input',
 
15
  )
16
+ iface.launch(inline = False)