markchiang commited on
Commit
b05691d
·
1 Parent(s): 8cbae1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -13
app.py CHANGED
@@ -4,20 +4,10 @@ import urllib
4
  import tensorflow as tf
5
  from tensorflow.keras import layers, models, optimizers
6
  import gradio as gr
7
- from tensorflow.keras.utils import get_custom_objects
8
- from app import CustomAdam
9
 
10
- # Define custom optimizer for loading saved model
11
- class CustomAdam(optimizers.Adam):
12
- def get_config(self):
13
- config = super().get_config()
14
- config['name'] = 'CustomAdam'
15
- return config
16
-
17
- get_custom_objects().update({'CustomAdam': CustomAdam})
18
-
19
- # Load pre-trained model with custom optimizer
20
- model = tf.keras.models.load_model('facial_condition_model.h5', custom_objects={'CustomAdam': CustomAdam})
21
 
22
  # Function to preprocess image for model input
23
  def preprocess_image(image):
 
4
  import tensorflow as tf
5
  from tensorflow.keras import layers, models, optimizers
6
  import gradio as gr
7
+ import os
 
8
 
9
+ # Load pre-trained model
10
+ model = tf.keras.models.load_model('facial_condition_model.h5')
 
 
 
 
 
 
 
 
 
11
 
12
  # Function to preprocess image for model input
13
  def preprocess_image(image):