Lord-Raven commited on
Commit
d04fba3
·
1 Parent(s): 93643d5

Trying zero-shot classification.

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -1,10 +1,15 @@
1
  import gradio
2
- def zero_shot_classification(name):
3
- return "Hello " + name + "!!"
 
 
 
 
 
4
 
5
  gradio_interface = gradio.Interface(
6
  fn = zero_shot_classification,
7
- inputs = "text",
8
- outputs = "text"
9
  )
10
  gradio_interface.launch()
 
1
  import gradio
2
+ from transformers import pipeline
3
+
4
+ def zero_shot_classification(data):
5
+ classifier = pipeline('zero-shot-classification, model='Xenova/mobilebert-uncased-mnli')
6
+
7
+ results = classifier(data.sequence, candidate_labels=data.candidate_labels, hypothesis_template=data.hypothesis_template, multi_label=data.multi_label)
8
+ return {results}
9
 
10
  gradio_interface = gradio.Interface(
11
  fn = zero_shot_classification,
12
+ inputs = "json",
13
+ outputs = "json"
14
  )
15
  gradio_interface.launch()