import gradio as gr from fastai.vision.all import * learn = load_learner("model_weights.pth") def predict(image): drink, _, probs = learn.predict(image) probability = max(list(map(float, probs))) return f"this is most likely a {drink} with probability {probability}." demo = gr.Interface(fn=predict, inputs="image", outputs="text") demo.launch()