wendys-llc's picture
Update app.py
d2888a8
raw
history blame
398 Bytes
import gradio as gr
from transformers import pipeline
def do_action(text):
pipe = pipeline("text-classification", model="papluca/xlm-roberta-base-language-detection")
result = pipe(text, top_k=10)
# Reformat our result
result = {item['label']: item['score'] for item in result}
return result
iface = gr.Interface(fn=do_action, inputs="text", outputs="label")
iface.launch()