macapa's picture
Update app.py
7693766
raw
history blame contribute delete
653 Bytes
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)