from fastai.vision.all import * import gradio as gr learn = load_learner('export (1).pkl') labels = learn.dls.vocab def predict(frase): pred, pred_idx, probs = learn.predict(frase) return {labels[i]: float(probs[i]) for i in range(len(labels))} gr.Interface(fn=predict, inputs=gr.Textbox() , outputs=gr.Label(num_top_classes=3), examples=['frase1.txt','frase2.txt2']).launch(share=False)