fohy24 commited on
Commit ·
1e21512
1
Parent(s): bddc3d6
added time.sleep to wait until the model is completely downloaded
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ from torchvision import models
|
|
| 4 |
from torchvision.transforms import v2
|
| 5 |
import os
|
| 6 |
import requests
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
labels = ['Pastel',
|
|
@@ -56,6 +57,7 @@ def predict(img, confidence):
|
|
| 56 |
# Download model from GCS
|
| 57 |
model_path = os.getenv('model_path')
|
| 58 |
response = requests.get(model_path)
|
|
|
|
| 59 |
|
| 60 |
with open('model.pt', 'wb') as f:
|
| 61 |
f.write(response.content)
|
|
|
|
| 4 |
from torchvision.transforms import v2
|
| 5 |
import os
|
| 6 |
import requests
|
| 7 |
+
import time
|
| 8 |
|
| 9 |
|
| 10 |
labels = ['Pastel',
|
|
|
|
| 57 |
# Download model from GCS
|
| 58 |
model_path = os.getenv('model_path')
|
| 59 |
response = requests.get(model_path)
|
| 60 |
+
time.sleep(120)
|
| 61 |
|
| 62 |
with open('model.pt', 'wb') as f:
|
| 63 |
f.write(response.content)
|