Spaces:
Sleeping
Sleeping
File size: 653 Bytes
910f661 7693766 910f661 9ed7bb3 910f661 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from fastai.text.all import *
from huggingface_hub import from_pretrained_fastai
import gradio as gr
# Cargamos el learner
repo_id = "macapa/emotion-text-better"
learner = from_pretrained_fastai(repo_id)
# Definimos la función que realiza las predicciones
def predict(text):
pred = learner.predict(text)
return pred
texto1 = 'i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake'
texto2 = 'im grabbing a minute to post i feel greedy wrong'
# Creamos la interfaz y la lanzamos.
gr.Interface(fn=predict, inputs="text", outputs="text", examples=[texto1,texto2]).launch(share=False) |