hemantha-14 commited on
Commit
b6c113d
·
verified ·
1 Parent(s): 115ece5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -1,22 +1,16 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
-
4
- # Load the sentiment-analysis pipeline
5
  classifier = pipeline("sentiment-analysis")
6
-
7
- # Define the function that will process input text
8
  def analyze_sentiment(text):
9
  return classifier(text)
10
-
11
- # Set up the Gradio interface with a submit button instead of clear
12
  interface = gr.Interface(
13
  fn=analyze_sentiment,
14
  inputs=gr.Textbox(label="Input Text", placeholder="Enter your text here..."),
15
- outputs=[gr.Textbox(label="Sentiment Output")], # Adding label to output
16
- live=False, # Set live to False, so the model runs when the "Submit" button is clicked
17
- title="Sentiment Analysis", # Optional, to give the interface a title
18
  description="Enter text to analyze its sentiment. The model will predict whether the sentiment is positive or negative.",
19
- theme="compact" # Optional, to make the interface look more compact
20
  )
21
 
22
  interface.launch()
 
1
  import gradio as gr
2
  from transformers import pipeline
 
 
3
  classifier = pipeline("sentiment-analysis")
 
 
4
  def analyze_sentiment(text):
5
  return classifier(text)
 
 
6
  interface = gr.Interface(
7
  fn=analyze_sentiment,
8
  inputs=gr.Textbox(label="Input Text", placeholder="Enter your text here..."),
9
+ outputs=[gr.Textbox(label="Sentiment Output")],
10
+ live=False,
11
+ title="Sentiment Analysis",
12
  description="Enter text to analyze its sentiment. The model will predict whether the sentiment is positive or negative.",
13
+ theme="compact"
14
  )
15
 
16
  interface.launch()