farid678 commited on
Commit
dabc461
1 Parent(s): e7741b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -1,9 +1,18 @@
1
  import gradio as gr
2
- from model import model
3
  import numpy as np
4
 
5
 
6
- def predict_age_gender(image):
 
 
 
 
 
 
 
 
 
7
  img_pixels = np.expand_dims(image, axis=0)
8
  img_pixels = image.astype('float')
9
  img_pixels = img_pixels.reshape((1, 128, 128, 3))
 
1
  import gradio as gr
2
+ from keras.models import model_from_json
3
  import numpy as np
4
 
5
 
6
+
7
+ json_file = open('xception.json', 'r')
8
+ loaded_file_json = json_file.read()
9
+ json_file.close()
10
+
11
+ model = model_from_json(loaded_file_json)
12
+ model.load_weights('xception_modelv2.h5')
13
+
14
+
15
+ def predict_age_gender(image, model=model):
16
  img_pixels = np.expand_dims(image, axis=0)
17
  img_pixels = image.astype('float')
18
  img_pixels = img_pixels.reshape((1, 128, 128, 3))