Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,14 +10,15 @@ from tensorflow.keras.applications.inception_resnet_v2 import InceptionResNetV2
|
|
| 10 |
#os.environ['TF_ENABLE_ONEDNN_OPTS']='0'
|
| 11 |
model=load_model('best_model_76.h5')
|
| 12 |
|
|
|
|
| 13 |
def classify_image(inp):
|
| 14 |
-
inp = inp.reshape((-1,
|
| 15 |
-
|
| 16 |
prediction = model.predict(inp).flatten()
|
| 17 |
return {labels[i]: float(prediction[i]) for i in range(NUM_CLASSES)}
|
| 18 |
|
| 19 |
-
image = gr.
|
| 20 |
-
label = gr.
|
| 21 |
|
| 22 |
gr.Interface(fn=classify_image, inputs=image, outputs=label, title='Brand Logo Detection').launch(debug=False)
|
| 23 |
|
|
|
|
| 10 |
#os.environ['TF_ENABLE_ONEDNN_OPTS']='0'
|
| 11 |
model=load_model('best_model_76.h5')
|
| 12 |
|
| 13 |
+
|
| 14 |
def classify_image(inp):
|
| 15 |
+
inp = inp.reshape((-1, HEIGHT,WIDTH, 3))
|
| 16 |
+
inp = tf.keras.applications.nasnet.preprocess_input(inp)
|
| 17 |
prediction = model.predict(inp).flatten()
|
| 18 |
return {labels[i]: float(prediction[i]) for i in range(NUM_CLASSES)}
|
| 19 |
|
| 20 |
+
image = gr.Image(shape=(HEIGHT,WIDTH),label='Input')
|
| 21 |
+
label = gr.Label()
|
| 22 |
|
| 23 |
gr.Interface(fn=classify_image, inputs=image, outputs=label, title='Brand Logo Detection').launch(debug=False)
|
| 24 |
|