File size: 518 Bytes
a31e89a a44c2a2 28dedab a31e89a a44c2a2 28dedab a44c2a2 2c764d8 28dedab 2c764d8 a31e89a 28dedab 96f9498 28dedab 96f9498 28dedab 96f9498 28dedab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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()
|