import tensorflow_addons as tfa import gradio as gr import tensorflow as tf import numpy as np from tensorflow.keras.models import load_model model=load_model('/content/saved_model/best_model.h5') def classify_image(inp): inp = inp.reshape((-1, IMG_SIZE, IMG_SIZE, 3)) #inp = tf.keras.applications.vgg16.preprocess_input(inp) prediction = model.predict(inp).flatten() return {labels[i]: float(prediction[i]) for i in range(NUM_CLASSES)} image = gr.inputs.Image(shape=(IMG_SIZE, IMG_SIZE),label='Input') label = gr.outputs.Label(num_top_classes=2) gr.Interface(fn=classify_image, inputs=image, outputs=label, title='Cats Vs Dogs',height=600, width=1200).launch(debug=False)