sbicy commited on
Commit
a9f30fb
·
verified ·
1 Parent(s): 264cc73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,7 +1,8 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- classifier = pipeline('sentiment-analysis')
 
5
 
6
  def sentiment_analysis(text):
7
  result = classifier(text)[0]
@@ -9,8 +10,8 @@ def sentiment_analysis(text):
9
 
10
  iface = gr.Interface(
11
  fn=sentiment_analysis,
12
- inputs=gr.inputs.Textbox(lines=2, placeholder="Enter text here..."),
13
- outputs="text",
14
  title="Simple Sentiment Analysis",
15
  description="Enter a sentence and see if it's Positive or Negative!"
16
  )
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Load the sentiment-analysis pipeline with a specified model
5
+ classifier = pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english')
6
 
7
  def sentiment_analysis(text):
8
  result = classifier(text)[0]
 
10
 
11
  iface = gr.Interface(
12
  fn=sentiment_analysis,
13
+ inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
14
+ outputs=gr.Textbox(),
15
  title="Simple Sentiment Analysis",
16
  description="Enter a sentence and see if it's Positive or Negative!"
17
  )