Spaces:
Sleeping
Sleeping
File size: 551 Bytes
ef37f64 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
from transformers import pipeline
# Load a simple sentiment analysis model
classifier = pipeline("sentiment-analysis")
def analyze_text(text):
result = classifier(text)[0]
return f"Label: {result['label']}, Confidence: {result['score']:.2f}"
# Create the Gradio interface
demo = gr.Interface(
fn=analyze_text,
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
outputs="text",
title="Text Sentiment Analysis",
description="Enter some text and I'll analyze its sentiment.",
)
demo.launch() |