Spaces:
Sleeping
Sleeping
| from transformers import pipeline | |
| import gradio as gr | |
| # Load sentiment analysis pipeline | |
| # classifier_pipeline = pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis") | |
| classifier_pipeline = ("sentiment-analysis") | |
| # Define classification function | |
| def classify_text(text): | |
| output = classifier_pipeline(text) | |
| return output[0] # Extract the first result from the list | |
| # Define Gradio interface | |
| interface = gr.Interface( | |
| fn=classify_text, | |
| inputs=gr.Textbox(label="Enter sentence here"), | |
| outputs=gr.Label(), | |
| examples=["I am hungry", "I love this product!", "This is the worst experience ever."] | |
| ) | |
| # Launch the interface | |
| interface.launch() |