Spaces:
Runtime error
Runtime error
import gradio as gr | |
from huggingface_hub import from_pretrained_fastai | |
learn = from_pretrained_fastai("rubendewasch/porsche_or_bmw") | |
categories = ('BMW', 'Porsche') | |
def predict(input_img): | |
pred,idx,probs = learn.predict(input_img) | |
return dict(zip(categories, map(float,probs))) | |
gradio_app = gr.Interface( | |
predict, | |
inputs=gr.Image(label="Select car picture", sources=['upload', 'webcam'], type="pil"), | |
outputs=[gr.Label(label="Result")], | |
title="Porsche or BMW?", | |
) | |
if __name__ == "__main__": | |
gradio_app.launch() | |