hesha commited on
Commit
dac603c
1 Parent(s): 3463e3f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ model = 'MoritzLaurer/deberta-v3-base-zeroshot-v1.1-all-33'
5
+ pipe = pipeline('zero-shot-classification', model=model)
6
+
7
+ def infer(text, classes, multi_label):
8
+ output = pipe(text, classes, multi_label=multi_label)
9
+ return output
10
+
11
+ text_input = gr.Textbox(lines=5, placeholder='Once upon a time...', label='Text Source', show_label=True)
12
+ class_input = gr.Textbox(value='positive,negative', label='Class Label', show_label=True)
13
+ allow_multi_label = gr.Checkbox(value=True, label='Multiple True Classes')
14
+
15
+ app = gr.Interface(fn=infer, inputs=[text_input, class_input, allow_multi_label], outputs='label')
16
+ app.launch()