Moodify / app.py
Haticece's picture
Update app.py
003a10c verified
raw
history blame contribute delete
392 Bytes
import gradio as gr
from transformers import pipeline
def sentiment_analysis(text):
classifier = pipeline('sentiment-analysis')
result = classifier(text)
sentiment = result[0]['label']
score = result[0]['score']
return f"Sentiment: {sentiment} (Score: {score:.2f})"
interface = gr.Interface(fn=sentiment_analysis, inputs="text", outputs="text")
interface.launch()