Commit
·
d2888a8
1
Parent(s):
d688851
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,10 @@ def do_action(text):
|
|
| 5 |
pipe = pipeline("text-classification", model="papluca/xlm-roberta-base-language-detection")
|
| 6 |
result = pipe(text, top_k=10)
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
return result
|
| 9 |
|
| 10 |
-
iface = gr.Interface(fn=do_action, inputs="text", outputs="
|
| 11 |
iface.launch()
|
|
|
|
| 5 |
pipe = pipeline("text-classification", model="papluca/xlm-roberta-base-language-detection")
|
| 6 |
result = pipe(text, top_k=10)
|
| 7 |
|
| 8 |
+
# Reformat our result
|
| 9 |
+
result = {item['label']: item['score'] for item in result}
|
| 10 |
+
|
| 11 |
return result
|
| 12 |
|
| 13 |
+
iface = gr.Interface(fn=do_action, inputs="text", outputs="label")
|
| 14 |
iface.launch()
|