Spaces:
Runtime error
Runtime error
File size: 501 Bytes
750c19d 1c24fce 750c19d 26331ac 750c19d eebc7aa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from huggingface_hub import from_pretrained_fastai
import gradio as gr
from fastai.vision.all import *
repo_id = "MarioGL/emotion"
learn = load_learner(repo_id)
def classify_text(text):
pred, pred_idx, probs = learn.predict(text)
return pred, probs[pred_idx].item()
iface = gr.Interface(fn=classify_text,
inputs=gr.Textbox(label="Introduce un texto"),
outputs=[gr.Label(), gr.Textbox()],
live=True)
iface.launch() |