Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
import numpy as np
|
|
|
4 |
|
5 |
num_classes = 200
|
6 |
IMG_HEIGHT = 300
|
@@ -17,11 +18,13 @@ def normalize_image(img):
|
|
17 |
def load_model(model_name):
|
18 |
# Load the model based on the model_name input
|
19 |
if model_name == "model1":
|
20 |
-
return tf.keras.models.load_model("
|
21 |
elif model_name == "model2":
|
22 |
-
return tf.keras.models.load_model("
|
23 |
elif model_name == "model3":
|
24 |
-
return tf.keras.models.load_model("
|
|
|
|
|
25 |
else:
|
26 |
raise ValueError("Invalid model_name")
|
27 |
|
@@ -46,6 +49,7 @@ interface = gr.Interface(
|
|
46 |
gr.inputs.Button(label="Model 1 (Xception)", value="model1"),
|
47 |
gr.inputs.Button(label="Model 2 (InceptionV3)", value="model2"),
|
48 |
gr.inputs.Button(label="Model 3 (InceptionResNetV2)", value="model3"),
|
|
|
49 |
],
|
50 |
outputs='label'
|
51 |
)
|
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
import numpy as np
|
4 |
+
import os
|
5 |
|
6 |
num_classes = 200
|
7 |
IMG_HEIGHT = 300
|
|
|
18 |
def load_model(model_name):
|
19 |
# Load the model based on the model_name input
|
20 |
if model_name == "model1":
|
21 |
+
return tf.keras.models.load_model("Xception.h5")
|
22 |
elif model_name == "model2":
|
23 |
+
return tf.keras.models.load_model("InceptionV3.h5")
|
24 |
elif model_name == "model3":
|
25 |
+
return tf.keras.models.load_model("InceptionResNetV2.h5")
|
26 |
+
elif model_name == "model4":
|
27 |
+
return tf.keras.models.load_model("DenseNet201.h5")
|
28 |
else:
|
29 |
raise ValueError("Invalid model_name")
|
30 |
|
|
|
49 |
gr.inputs.Button(label="Model 1 (Xception)", value="model1"),
|
50 |
gr.inputs.Button(label="Model 2 (InceptionV3)", value="model2"),
|
51 |
gr.inputs.Button(label="Model 3 (InceptionResNetV2)", value="model3"),
|
52 |
+
gr.inputs.Button(label="Model 4 (DenseNet201)", value="model4"),
|
53 |
],
|
54 |
outputs='label'
|
55 |
)
|