willco-afk commited on
Commit
e8c41c8
·
verified ·
1 Parent(s): 9d38150

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -6,18 +6,21 @@ from PIL import Image
6
  import zipfile
7
  import gdown
8
 
9
- # Path to your zipped model file
10
- ZIP_MODEL_URL = 'https://drive.google.com/uc?id=1-4p6AZBkooWL1rhN9WwIrfd9fJbhzY0e' # Google Drive link to the model
11
- UNZIPPED_MODEL_PATH = '/app/your_trained_model.keras' # Path where the model will be extracted
12
 
13
- # Download the model from Google Drive if it hasn't been downloaded already
14
- if not os.path.exists(UNZIPPED_MODEL_PATH):
15
- # Download model from Google Drive
16
- output = '/app/your_trained_model_resnet50.keras.zip' # Path where model will be saved
17
- gdown.download(ZIP_MODEL_URL, output, quiet=False)
 
 
18
 
19
- # Unzip the model
20
- with zipfile.ZipFile(output, 'r') as zip_ref:
 
21
  zip_ref.extractall('/app')
22
  print(f"Model unzipped to {UNZIPPED_MODEL_PATH}")
23
 
 
6
  import zipfile
7
  import gdown
8
 
9
+ # Path to your zipped model file (this will be the local path after downloading)
10
+ ZIP_MODEL_PATH = '/app/your_trained_model_resnet50.keras.zip'
11
+ UNZIPPED_MODEL_PATH = '/app/your_trained_model_resnet50.keras' # Path where the model will be extracted
12
 
13
+ # Google Drive link to the model file
14
+ MODEL_URL = 'https://drive.google.com/uc?export=download&id=1-4p6AZBkooWL1rhN9WwIrfd9fJbhzY0e'
15
+
16
+ # Download the model if it doesn't exist
17
+ if not os.path.exists(ZIP_MODEL_PATH):
18
+ gdown.download(MODEL_URL, ZIP_MODEL_PATH, quiet=False)
19
+ print(f"Model downloaded to {ZIP_MODEL_PATH}")
20
 
21
+ # Unzip the model if it hasn't been unzipped already
22
+ if not os.path.exists(UNZIPPED_MODEL_PATH):
23
+ with zipfile.ZipFile(ZIP_MODEL_PATH, 'r') as zip_ref:
24
  zip_ref.extractall('/app')
25
  print(f"Model unzipped to {UNZIPPED_MODEL_PATH}")
26