willco-afk commited on
Commit
6be805d
·
verified ·
1 Parent(s): b072739

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -4,14 +4,20 @@ import numpy as np
4
  import tensorflow as tf
5
  from PIL import Image
6
  import zipfile
 
7
 
8
  # Path to your zipped model file
9
- ZIP_MODEL_PATH = '/app/your_trained_model_resnet50.keras.zip' # Updated path for the new model
10
- UNZIPPED_MODEL_PATH = '/app/your_trained_model_resnet50.keras' # Path where the model will be extracted
11
 
12
- # Unzip the model if it hasn't been unzipped already
13
  if not os.path.exists(UNZIPPED_MODEL_PATH):
14
- with zipfile.ZipFile(ZIP_MODEL_PATH, 'r') as zip_ref:
 
 
 
 
 
15
  zip_ref.extractall('/app')
16
  print(f"Model unzipped to {UNZIPPED_MODEL_PATH}")
17
 
 
4
  import tensorflow as tf
5
  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