Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import requests
|
|
| 5 |
import time
|
| 6 |
import re
|
| 7 |
from huggingface_hub import hf_hub_download, list_repo_files
|
|
|
|
| 8 |
|
| 9 |
app_root = os.path.dirname(os.path.abspath(__file__))
|
| 10 |
app_root = os.path.join(app_root, "src/app")
|
|
@@ -19,12 +20,12 @@ selected_videos = {
|
|
| 19 |
'002093': 'cleaning the window',
|
| 20 |
'002550': 'walking in a Zig-Zag pattern',
|
| 21 |
'003111': 'dancing',
|
| 22 |
-
'003712': '
|
| 23 |
'004163': 'flying like a bird',
|
| 24 |
'004455': 'running in place',
|
| 25 |
'004912': 'swimming',
|
| 26 |
'005458': 'running forward',
|
| 27 |
-
'005869': '
|
| 28 |
'006662': 'falling down',
|
| 29 |
'006979': 'punching',
|
| 30 |
'007354': 'crawling',
|
|
@@ -88,9 +89,9 @@ def download_files_from_huggingface(repo_id, repo_type, max_retries=3):
|
|
| 88 |
print(f"Successfully Download: {file}")
|
| 89 |
rename_files_with_six_digit_code(os.path.join(local_path, os.path.basename(file)))
|
| 90 |
break
|
| 91 |
-
except (requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError) as e:
|
| 92 |
if attempt < max_retries - 1:
|
| 93 |
-
wait_time = (attempt + 1)*
|
| 94 |
print(f"Download failed, retrying in {wait_time} seconds")
|
| 95 |
time.sleep(wait_time)
|
| 96 |
except FileExistsError:
|
|
|
|
| 5 |
import time
|
| 6 |
import re
|
| 7 |
from huggingface_hub import hf_hub_download, list_repo_files
|
| 8 |
+
from huggingface_hub.errors import LocalEntryNotFoundError
|
| 9 |
|
| 10 |
app_root = os.path.dirname(os.path.abspath(__file__))
|
| 11 |
app_root = os.path.join(app_root, "src/app")
|
|
|
|
| 20 |
'002093': 'cleaning the window',
|
| 21 |
'002550': 'walking in a Zig-Zag pattern',
|
| 22 |
'003111': 'dancing',
|
| 23 |
+
'003712': 'kneeling down and crawling',
|
| 24 |
'004163': 'flying like a bird',
|
| 25 |
'004455': 'running in place',
|
| 26 |
'004912': 'swimming',
|
| 27 |
'005458': 'running forward',
|
| 28 |
+
'005869': 'picking up something',
|
| 29 |
'006662': 'falling down',
|
| 30 |
'006979': 'punching',
|
| 31 |
'007354': 'crawling',
|
|
|
|
| 89 |
print(f"Successfully Download: {file}")
|
| 90 |
rename_files_with_six_digit_code(os.path.join(local_path, os.path.basename(file)))
|
| 91 |
break
|
| 92 |
+
except (requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError, LocalEntryNotFoundError) as e:
|
| 93 |
if attempt < max_retries - 1:
|
| 94 |
+
wait_time = (attempt + 1)*200
|
| 95 |
print(f"Download failed, retrying in {wait_time} seconds")
|
| 96 |
time.sleep(wait_time)
|
| 97 |
except FileExistsError:
|