fohy24 commited on
Commit ·
a960175
1
Parent(s): 1e21512
fixing model download
Browse files
app.py
CHANGED
|
@@ -55,13 +55,14 @@ def predict(img, confidence):
|
|
| 55 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 56 |
|
| 57 |
# Download model from GCS
|
| 58 |
-
model_path = os.getenv('
|
| 59 |
response = requests.get(model_path)
|
| 60 |
-
time.sleep(
|
| 61 |
|
| 62 |
with open('model.pt', 'wb') as f:
|
| 63 |
f.write(response.content)
|
| 64 |
-
|
|
|
|
| 65 |
checkpoint = torch.load('model.pt', map_location=device)
|
| 66 |
densenet.load_state_dict(checkpoint['model_state_dict'])
|
| 67 |
|
|
|
|
| 55 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 56 |
|
| 57 |
# Download model from GCS
|
| 58 |
+
model_path = os.getenv('MODEL_PATH')
|
| 59 |
response = requests.get(model_path)
|
| 60 |
+
time.sleep(30)
|
| 61 |
|
| 62 |
with open('model.pt', 'wb') as f:
|
| 63 |
f.write(response.content)
|
| 64 |
+
time.sleep(30)
|
| 65 |
+
|
| 66 |
checkpoint = torch.load('model.pt', map_location=device)
|
| 67 |
densenet.load_state_dict(checkpoint['model_state_dict'])
|
| 68 |
|