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 dict(zip(categories, map(float,probs))) intf = gr.Interface(fn=classify,inputs="text",outputs=label) intf.launch()