Sa-m's picture
Update app.py
303a695
raw
history blame
677 Bytes
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('best_model_76.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='Brand Logo Detection',height=600, width=1200).launch(debug=False)