AdhamQQ commited on
Commit
12d6038
·
verified ·
1 Parent(s): cf1c5a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -5,7 +5,7 @@ import torch.nn as nn
5
  from torchvision import transforms
6
  from PIL import Image
7
  import numpy as np
8
- import tensorflow as tf
9
  import os
10
  import requests
11
  import cv2
@@ -16,7 +16,7 @@ st.markdown("Upload a full-face image. The system will detect the affected side
16
  @st.cache_resource
17
  def download_models():
18
  model_urls = {
19
- "cnn_stroke_model.h5": "https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/cnn_stroke_model.h5",
20
  "left_side_pain_classifier.pth": "https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/left_side_pain_classifier.pth",
21
  "right_side_pain_classifier.pth": "https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/right_side_pain_classifier.pth",
22
  }
@@ -40,7 +40,7 @@ def download_models():
40
  f.write(r.content)
41
 
42
  # Load stroke model
43
- stroke_model = tf.keras.models.load_model("cnn_stroke_model.h5")
44
 
45
  # Define corrected PainModel class
46
  class PainModel(nn.Module):
 
5
  from torchvision import transforms
6
  from PIL import Image
7
  import numpy as np
8
+ from tensorflow.keras.models import load_model
9
  import os
10
  import requests
11
  import cv2
 
16
  @st.cache_resource
17
  def download_models():
18
  model_urls = {
19
+ "cnn_stroke_model": "https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/cnn_stroke_model",
20
  "left_side_pain_classifier.pth": "https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/left_side_pain_classifier.pth",
21
  "right_side_pain_classifier.pth": "https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/right_side_pain_classifier.pth",
22
  }
 
40
  f.write(r.content)
41
 
42
  # Load stroke model
43
+ stroke_model = load_model("cnn_stroke_model")
44
 
45
  # Define corrected PainModel class
46
  class PainModel(nn.Module):