Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
sentimentPipeline = pipeline('sentiment-analysis') | |
def analyze_sentiment(text): | |
result = sentimentPipeline(text) | |
return f"Sentiment: {result[0]['label']}, Confidence: {result[0]['score']:.2f}" | |
app = gr.Interface( | |
fn = analyze_sentiment, | |
inputs =gr.Textbox(lines = 5, placeholder = "Enter your text here:"), | |
outputs = "text", | |
title="Sentiment Analysis Tool", | |
description = "Sentiment Analysis Tool which helps you to analysis input tone" | |
) | |
if __name__ == "__main__": | |
app.launch() |