seefood / app.py
roni
gradio upgrade
28dedab
raw
history blame contribute delete
518 Bytes
import gradio as gr
from seefood_classifier_import import get_seefood_classifier
import PIL.Image
import numpy as np
classifier = get_seefood_classifier()
def classify(image):
im = PIL.Image.fromarray(np.array(image, dtype=np.uint8))
preds = classifier.predict_image(im)
results = {pred["label"]: pred["confidence"] for pred in preds}
return results
iface = gr.Interface(
fn=classify,
inputs="image",
outputs="label",
description="Upload your favourite food pic",
)
iface.launch()