Sadem-12 commited on
Commit
4c81f59
·
verified ·
1 Parent(s): 3ec4ae2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,11 +1,11 @@
1
- import gradio as gr
2
  from transformers import pipeline
3
  # Load the sentiment analysis pipeline
4
  sentiment_pipeline = pipeline("sentiment-analysis")
5
  def analyze_sentiment(text):
6
- result = sentiment_pipeline(text)[0]
7
- label = result["label"]
8
- score = result["score"]
9
  return f"Sentiment: {label}\nConfidence: {score:.2f}"
10
  # Create the Gradio interface
11
  iface = gr.Interface(
 
1
+ import gradio as gr
2
  from transformers import pipeline
3
  # Load the sentiment analysis pipeline
4
  sentiment_pipeline = pipeline("sentiment-analysis")
5
  def analyze_sentiment(text):
6
+ result = sentiment_pipeline(text)[0]
7
+ label = result["label"]
8
+ score = result["score"]
9
  return f"Sentiment: {label}\nConfidence: {score:.2f}"
10
  # Create the Gradio interface
11
  iface = gr.Interface(