Paraj01 commited on
Commit
3cc2bda
·
verified ·
1 Parent(s): 819ed72

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ classifier = pipeline("sentiment-analysis")
5
+
6
+ def classify_text(text):
7
+ result=classifier(text)
8
+ label=result[0]['label']
9
+ score = result[0]['score']
10
+
11
+ return f"{label} with score {score}"
12
+
13
+ interface = gr.Interface(
14
+ fn=classify_text,
15
+ inputs=gr.Textbox("Write anything(*-_-)"),
16
+ outputs="text",
17
+ title="Serntiment Analysis",
18
+ description="Enter Text to Check the Sentiment."
19
+ )
20
+
21
+ interface.launch(debug=True,share=True)