Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,15 +19,15 @@ import gradio as gr
|
|
| 19 |
def analyze_sentiment(text):
|
| 20 |
result = pipeline(text)[0]
|
| 21 |
label = result["label"]
|
| 22 |
-
score = result["score"]
|
| 23 |
return f"Sentiment: {label}\nConfidence: {score:.2f}"
|
| 24 |
|
| 25 |
# Create the Gradio interface
|
| 26 |
iface = gr.Interface(
|
| 27 |
fn=analyze_sentiment,
|
| 28 |
inputs=gr.Textbox(placeholder="Enter text to analyze..."),
|
| 29 |
-
outputs=[gr.Textbox(),
|
| 30 |
-
gr.Number(),
|
| 31 |
],
|
| 32 |
title="Sentiment Analysis App",
|
| 33 |
description="Enter a sentence to determine its sentiment (positive or negative).",
|
|
|
|
| 19 |
def analyze_sentiment(text):
|
| 20 |
result = pipeline(text)[0]
|
| 21 |
label = result["label"]
|
| 22 |
+
score = result["score"].range(1,6)
|
| 23 |
return f"Sentiment: {label}\nConfidence: {score:.2f}"
|
| 24 |
|
| 25 |
# Create the Gradio interface
|
| 26 |
iface = gr.Interface(
|
| 27 |
fn=analyze_sentiment,
|
| 28 |
inputs=gr.Textbox(placeholder="Enter text to analyze..."),
|
| 29 |
+
outputs=[gr.Textbox(label="Sentiment"),
|
| 30 |
+
gr.Number(label="Confidence"),
|
| 31 |
],
|
| 32 |
title="Sentiment Analysis App",
|
| 33 |
description="Enter a sentence to determine its sentiment (positive or negative).",
|