Dhana2403 commited on
Commit
f2e33e1
·
verified ·
1 Parent(s): 39bfcde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -6,13 +6,12 @@ sentiment_analyzer = pipeline('sentiment-analysis')
6
 
7
  # Define the function for sentiment analysis
8
  def analyze_sentiment(text):
9
- # Test the result here first before returning
10
  result = sentiment_analyzer(text)
11
- print(result) # Check the output format in the terminal
12
- return result
13
 
14
- # Set up the Gradio interface
15
- interface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="json")
16
 
17
  # Launch the Gradio interface
18
  interface.launch()
 
6
 
7
  # Define the function for sentiment analysis
8
  def analyze_sentiment(text):
 
9
  result = sentiment_analyzer(text)
10
+ # Only return the sentiment label
11
+ return result[0]['label']
12
 
13
+ # Set up the Gradio interface (use text output for easier debugging)
14
+ interface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text")
15
 
16
  # Launch the Gradio interface
17
  interface.launch()