Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 12 |
-
return result
|
| 13 |
|
| 14 |
-
# Set up the Gradio interface
|
| 15 |
-
interface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="
|
| 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()
|