import gradio as gr import tensorflow as tf import numpy as np import requests labels = [] def classify_image(inp): model = tf.keras.models.load('saved_model') inp = inp.reshape((-1, 480, 480, 3)) inp = tf.divide(inp,255.0) prediction = model.predict(inp).flatten() return {labels[i]: float(prediction[i]) for i in range(36)} image = gr.inputs.Image(shape=(480, 480)) label = gr.outputs.Label(num_top_classes=3) gr.Interface(fn=classify_image, inputs=image, outputs=label, capture_session=True, theme = "grass", examples = [["cat.jpeg"]]).launch()