ttphong68 commited on
Commit
97bdca3
·
1 Parent(s): ebab007

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +14 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as grad
3
+ zero_shot_classifier = pipeline("zero-shot-classification")
4
+
5
+
6
+ def classify(text,labels):
7
+ classifer_labels = labels.split(",")
8
+ #["software", "politics", "love", "movies", "emergency", "advertisment","sports"]
9
+ response = zero_shot_classifier(text,classifer_labels)
10
+ return response
11
+ txt=grad.Textbox(lines=1, label="English", placeholder="text to be classified")
12
+ labels=grad.Textbox(lines=1, label="Labels", placeholder="comma separated labels")
13
+ out=grad.Textbox(lines=1, label="Classification")
14
+ grad.Interface(classify, inputs=[txt,labels], outputs=out).launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ transformers
3
+ torch
4
+ transformers[sentencepiece]