Vaishvik1618 commited on
Commit
67cefec
1 Parent(s): 4683383

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ sentimentPipeline = pipeline('sentiment-analysis')
5
+
6
+ def analyze_sentiment(text):
7
+ result = sentimentPipeline(text)
8
+ return f"Sentiment: {result[0]['label']}, Confidence: {result[0]['score']:.2f}"
9
+
10
+ app = gr.Interface(
11
+ fn = analyze_sentiment,
12
+ inputs =gr.Textbox(lines = 5, placeholder = "Enter your text here:"),
13
+ outputs = "text",
14
+ title="Sentiment Analysis Tool",
15
+ description = "Sentiment Analysis Tool which helps you to analysis input tone"
16
+ )
17
+
18
+ if __name__ == "__main__":
19
+ app.launch()