Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from fastai.text.all import * | |
| from huggingface_hub import from_pretrained_fastai | |
| repo_id = "humellad/entregable_3" | |
| learn = from_pretrained_fastai(repo_id) | |
| def predict(text): | |
| pred, pred_idx, probs = learn.predict(text) | |
| vocab = learn.dls.vocab[1] | |
| return {vocab[i]: float(probs[i]) for i in range(len(vocab))} | |
| sample_examples = [ | |
| ["i never make her separate from me because i don t ever want her to feel like i m ashamed with her"], | |
| ["This makes me feel very sad and lonely."], | |
| ["I am absolutely furious about the delay."], | |
| ["It's a beautiful day to go for a walk in the park."], | |
| ["I feel a bit nervous about the upcoming presentation."] | |
| ] | |
| gr.Interface(fn=predict, inputs="text", outputs="label", examples=sample_examples).launch() |