Update app.py
Browse files
app.py
CHANGED
|
@@ -19,16 +19,19 @@ def download_weights():
|
|
| 19 |
|
| 20 |
for j in range(len(url)):
|
| 21 |
if not os.path.isfile(fname[j]):
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
try:
|
| 34 |
download_weights()
|
|
|
|
| 19 |
|
| 20 |
for j in range(len(url)):
|
| 21 |
if not os.path.isfile(fname[j]):
|
| 22 |
+
ntries = 0
|
| 23 |
+
while ntries<10:
|
| 24 |
+
try:
|
| 25 |
+
r = requests.get(url[j])
|
| 26 |
+
except:
|
| 27 |
+
print("!!! Failed to download data !!!")
|
| 28 |
+
ntries += 1
|
| 29 |
+
|
| 30 |
+
if r.status_code != requests.codes.ok:
|
| 31 |
+
print("!!! Failed to download data !!!")
|
| 32 |
+
else:
|
| 33 |
+
with open(fname[j], "wb") as fid:
|
| 34 |
+
fid.write(r.content)
|
| 35 |
|
| 36 |
try:
|
| 37 |
download_weights()
|