wendys-llc commited on
Commit
a01581e
1 Parent(s): c7102bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -2,15 +2,10 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  def do_action(text):
5
- classifier = pipeline("zero-shot-classification",
6
- model="facebook/bart-large-mnli")
7
-
8
- candidate_labels = ['gun control', 'abortion', 'gender transition', 'freedom of speech', 'immigration', 'taxes']
9
- result = classifier(text, candidate_labels)
10
-
11
- result = dict(zip(result['labels'], result['scores']))
12
 
13
  return result
14
 
15
- iface = gr.Interface(fn=do_action, inputs="text", outputs="label")
16
  iface.launch()
 
2
  from transformers import pipeline
3
 
4
  def do_action(text):
5
+ pipe = pipeline("text-classification", model="papluca/xlm-roberta-base-language-detection")
6
+ result = pipe(text)
 
 
 
 
 
7
 
8
  return result
9
 
10
+ iface = gr.Interface(fn=do_action, inputs="text", outputs="text")
11
  iface.launch()