Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
# Load the sentiment analysis model | |
classifier = pipeline('sentiment-analysis') | |
def sentiment_analysis(text): | |
result = classifier(text) | |
return result[0]['label'], result[0]['score'] | |
# Create a Gradio interface | |
demo = gr.Interface(fn=sentiment_analysis, inputs="text", outputs=["text", "number"]) | |
# Launch the Gradio app | |
demo.launch() | |