Spaces:
Runtime error
Runtime error
from huggingface_hub import from_pretrained_fastai | |
import gradio as gr | |
from fastai.vision.all import * | |
# repo_id = "YOUR_USERNAME/YOUR_LEARNER_NAME" | |
repo_id = "kylar55/entregable3_1" | |
learner = from_pretrained_fastai(repo_id) | |
labels = learner.dls.vocab | |
# Definimos una función que se encarga de llevar a cabo las predicciones | |
def predict(text): | |
pred,pred_idx,probs = learner.predict(text) | |
if pred == "en": | |
return "Ingles" | |
if pred == "ja": | |
return "Japonés" | |
if pred == "es": | |
return "Español" | |
else: | |
return "other" | |
# Creamos la interfaz y la lanzamos. | |
gr.Interface(fn=predict, inputs=gr.inputs.Textbox(), outputs=gr.outputs.Label(),examples=["娘が1歳になったので新しい知育玩具を探していたところリーズナブルで見た目も可愛いこちらの商品に辿りつきました。","Esta frase no es un meme","Highly recommend for those who don't like being spoon fed CGI garbage."]).launch(share=False) | |