nadzo's picture
Update app.py
228b0be verified
raw
history blame
422 Bytes
import gradio as gr
from transformers import pipeline
# Load sentiment analysis model
sentiment_pipeline = pipeline("sentiment-analysis")
def analyze(text):
result = sentiment_pipeline(text)[0]
return f"{result['label']} (Confidence: {result['score']:.2f})"
# Create Gradio interface
gr.Interface(
fn=analyze,
inputs=gr.Textbox(placeholder="Enter crypto news headline..."),
outputs="text"
).launch()