import gradio as gr from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("NikiTricky/resnet50-food101") def classify_image(inp): inp = inp.reshape((-1, 224, 224, 3)) inp /= 255.0 prediction = model.predict(inp) confidences = {model.config['id2label'][str(i)]: float(prediction[i]) for i in range(101)} return confidences gr.Interface(fn=classify_image, inputs=gr.Image(shape=(224, 224)), outputs=gr.Label(num_top_classes=3)).launch()