Commit
•
a01581e
1
Parent(s):
c7102bb
Update app.py
Browse files
app.py
CHANGED
@@ -2,15 +2,10 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
def do_action(text):
|
5 |
-
|
6 |
-
|
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="
|
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()
|