from fastai.text.all import * import gradio as gr learn.load_learner('export.pkl') categories = ('Negative', 'Positive') label = gr.outputs.Label() def classify(text): pred,pred_idx,probs = learn.predict(text) return {labels[i]: float(probs[i]) for i in range(len(labels))} intf = gr.Interface(classify,"text",label) intf.launch()