newaimodel / app.py
saintyboy's picture
Create app.py
7805bd4 verified
raw
history blame
No virus
400 Bytes
import gradio as gr
from transformers import pipeline
# Load the sentiment analysis model
classifier = pipeline('sentiment-analysis')
def sentiment_analysis(text):
result = classifier(text)
return result[0]['label'], result[0]['score']
# Create a Gradio interface
demo = gr.Interface(fn=sentiment_analysis, inputs="text", outputs=["text", "number"])
# Launch the Gradio app
demo.launch()