farooq-09 commited on
Commit
e8e7408
β€’
1 Parent(s): e22627d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pip install gradio transformers
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+ text_classifier = pipeline('sentiment-analysis')
5
+ def predict(text):
6
+ result = text_classifier(text)
7
+ return result[0]['label']
8
+ iface = gr.Interface(
9
+ fn=predict,
10
+ inputs=gr.Textbox(),
11
+ outputs=gr.Textbox()
12
+ )
13
+ iface = gr.Interface(
14
+ fn=predict,
15
+ inputs=gr.Textbox(),
16
+ outputs=gr.Textbox()
17
+ )
18
+ iface.launch()