QuratulainButt commited on
Commit
3b85f52
1 Parent(s): 6056a9a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ model_name = "distilbert/distilbert-base-uncased-finetuned-sst-2-english"
4
+ sentiment_analysis = pipeline("text-classification", model=model_name)
5
+
6
+ def pipe(text):
7
+ return "The entered sentence is " + str(sentiment_analysis (text)(0)['label'])+ "!"
8
+
9
+
10
+
11
+ demo = gr.Interface(
12
+ fn=pipe,
13
+ inputs=["text"],
14
+ outputs=["text"],
15
+ )
16
+
17
+ demo.launch()
18
+