Spaces:
Sleeping
Sleeping
File size: 418 Bytes
bc4e787 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import gradio as gr
from transformers import pipeline
# Load the pre-trained sentiment-analysis pipeline
classifier = pipeline('sentiment-analysis')
# Function to classify sentiment
def classify_text(text):
result = classifier(text)[0]
return f"{result['label']} with score {result['score']}"
# Set up the Gradio interface
iface = gr.Interface(fn=classify_text, inputs="text", outputs="text")
iface.launch() |