Spaces:
Sleeping
Sleeping
File size: 419 Bytes
2e48c0b fdd6c06 2e48c0b fdd6c06 d8dbb05 2e48c0b fdd6c06 2e48c0b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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()
|