Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,16 +15,16 @@ def sentiment_analysis(text: str) -> dict:
|
|
| 15 |
sentiment = blob.sentiment
|
| 16 |
return {
|
| 17 |
"polarity": round(sentiment.polarity, 2),
|
| 18 |
-
"subjectivity": round(sentiment.subjectivity, 2)
|
| 19 |
-
"assessment": "positive" if sentiment.polarity > 0 else "negative" if sentiment.polarity < 0 else "neutral"
|
| 20 |
}
|
| 21 |
|
| 22 |
demo = gr.Interface(
|
| 23 |
fn = sentiment_analysis,
|
| 24 |
-
inputs = gr.Textbox(placeholder="Enter text to analyze...")
|
| 25 |
outputs = gr.JSON(),
|
| 26 |
title = "Text Sentiment Analysis",
|
| 27 |
-
description = "Analyze the sentment of text using TextBlob"
|
| 28 |
)
|
| 29 |
|
| 30 |
if __name__ == "__main__":
|
|
|
|
| 15 |
sentiment = blob.sentiment
|
| 16 |
return {
|
| 17 |
"polarity": round(sentiment.polarity, 2),
|
| 18 |
+
"subjectivity": round(sentiment.subjectivity, 2),
|
| 19 |
+
"assessment": "positive" if sentiment.polarity > 0 else "negative" if sentiment.polarity < 0 else "neutral",
|
| 20 |
}
|
| 21 |
|
| 22 |
demo = gr.Interface(
|
| 23 |
fn = sentiment_analysis,
|
| 24 |
+
inputs = gr.Textbox(placeholder="Enter text to analyze..."),
|
| 25 |
outputs = gr.JSON(),
|
| 26 |
title = "Text Sentiment Analysis",
|
| 27 |
+
description = "Analyze the sentment of text using TextBlob",
|
| 28 |
)
|
| 29 |
|
| 30 |
if __name__ == "__main__":
|