naman1011 commited on
Commit
4e706eb
·
1 Parent(s): 06e8b79

code cleanup

Browse files
Files changed (1) hide show
  1. app.py +1 -11
app.py CHANGED
@@ -15,11 +15,6 @@ from facenet_pytorch import MTCNN
15
  model_file_path = 'models/bmi.h5'
16
  model = tf.keras.models.load_model(model_file_path)
17
 
18
- # mtcnn2 = MTCNN(
19
- # image_size=160, margin=40, min_face_size=20,
20
- # thresholds=[0.6, 0.7, 0.7], factor=0.709, post_process=False
21
- # )
22
-
23
  # Preprocess the images for VGG16
24
  def preprocess_image(img_path):
25
  img = image.load_img(img_path, target_size = (224, 224))
@@ -37,15 +32,10 @@ def main():
37
  img_file_buffer = st.camera_input("Take a picture")
38
 
39
  if img_file_buffer is not None:
40
- # To read image file buffer as a PIL Image:
41
- # img = Image.open(img_file_buffer)
42
-
43
- # detected_image = Image.fromarray(mtcnn2(img).numpy().transpose(1, 2, 0).astype(np.uint8))
44
- # st.image(detected_image, caption="Detected Face")
45
 
46
  embeddings = preprocess_image(img_file_buffer)
47
  bmi = model.predict(embeddings)
48
- st.write(f"Your BMI is {bmi}")
49
 
50
  if __name__ == '__main__':
51
  main()
 
15
  model_file_path = 'models/bmi.h5'
16
  model = tf.keras.models.load_model(model_file_path)
17
 
 
 
 
 
 
18
  # Preprocess the images for VGG16
19
  def preprocess_image(img_path):
20
  img = image.load_img(img_path, target_size = (224, 224))
 
32
  img_file_buffer = st.camera_input("Take a picture")
33
 
34
  if img_file_buffer is not None:
 
 
 
 
 
35
 
36
  embeddings = preprocess_image(img_file_buffer)
37
  bmi = model.predict(embeddings)
38
+ st.write(f"Your BMI is {bmi[0][0]}")
39
 
40
  if __name__ == '__main__':
41
  main()