NickHerrig's picture
Add gradio example images
06ac5bd unverified
raw
history blame contribute delete
455 Bytes
import gradio as gr
from fastai.vision.all import *
learn = load_learner("model_weights.pth")
examples = ["cosmopolitan.jpeg", "old-fashioned.jpeg", "pina-colada.webp"]
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", examples=examples)
demo.launch()