Spaces:
Sleeping
Sleeping
File size: 568 Bytes
67cefec |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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() |