Spaces:
Build error
Build error
import gradio as gr | |
from textblob import TextBlob | |
def analyze(text): | |
blob = TextBlob(text) | |
polarity = blob.sentiment.polarity | |
sentiment = "Positive" if polarity > 0 else "Negative" if polarity < 0 else "Neutral" | |
return f"Sentiment: {sentiment} (Polarity: {polarity:.2f})" | |
iface = gr.Interface(fn=analyze, inputs="text", outputs="text") | |
iface.launch() |