Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,17 @@ import tensorflow as tf
|
|
4 |
import numpy as np
|
5 |
from tensorflow.keras.models import load_model
|
6 |
|
|
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
|
|
4 |
import numpy as np
|
5 |
from tensorflow.keras.models import load_model
|
6 |
|
7 |
+
model=load_model('/content/saved_model/best_model.h5')
|
8 |
|
9 |
+
def classify_image(inp):
|
10 |
+
inp = inp.reshape((-1, IMG_SIZE, IMG_SIZE, 3))
|
11 |
+
#inp = tf.keras.applications.vgg16.preprocess_input(inp)
|
12 |
+
prediction = model.predict(inp).flatten()
|
13 |
+
return {labels[i]: float(prediction[i]) for i in range(NUM_CLASSES)}
|
14 |
|
15 |
+
image = gr.inputs.Image(shape=(IMG_SIZE, IMG_SIZE),label='Input')
|
16 |
+
label = gr.outputs.Label(num_top_classes=2)
|
17 |
+
|
18 |
+
gr.Interface(fn=classify_image, inputs=image, outputs=label, title='Cats Vs Dogs',height=600, width=1200).launch(debug=False)
|
19 |
|
20 |
|