Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -2,18 +2,11 @@ import gradio as gr
|
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras.applications.inception_resnet_v2 import preprocess_input
|
4 |
from tensorflow.keras.preprocessing import image
|
|
|
5 |
import numpy as np
|
6 |
from PIL import Image
|
7 |
|
8 |
-
|
9 |
-
model_path = "best_model_InceptionV2.keras"
|
10 |
-
|
11 |
-
# Try to load the trained InceptionV2 model
|
12 |
-
try:
|
13 |
-
model = tf.keras.models.load_model(model_path)
|
14 |
-
print("Model loaded successfully.")
|
15 |
-
except Exception as e:
|
16 |
-
print(f"Error loading the model: {e}")
|
17 |
|
18 |
# Function for prediction
|
19 |
def predict(img):
|
|
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras.applications.inception_resnet_v2 import preprocess_input
|
4 |
from tensorflow.keras.preprocessing import image
|
5 |
+
from tensorflow.keras.models import load_model
|
6 |
import numpy as np
|
7 |
from PIL import Image
|
8 |
|
9 |
+
model = load_model('best_model_InceptionV2.keras')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Function for prediction
|
12 |
def predict(img):
|