abhi227070 commited on
Commit
4a2a22b
1 Parent(s): fa513ae

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
+ classifier = pipeline('text-classification', model="abhi227070/distilbert-base-uncased-finetuned-imdb")
5
+
6
+ def sentiment_analysis(text):
7
+
8
+ result = classifier(text)
9
+
10
+ return result[0]['label'], result[0]['score']
11
+
12
+
13
+ iface = gr.Interface(
14
+ fn = sentiment_analysis,
15
+ inputs = gr.Textbox(label="Context", placeholder="Enter your text here...", lines = 5),
16
+ outputs = [gr.Textbox(label="Result"), gr.Textbox(label="Accuracy")]
17
+ )
18
+
19
+ iface.launch()