Spaces:
Sleeping
Sleeping
zhou12189108
commited on
Commit
•
48504a3
1
Parent(s):
6cf3c2b
Delete get_all_model.py
Browse files- get_all_model.py +0 -29
get_all_model.py
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
from pathlib import Path
|
3 |
-
import requests
|
4 |
-
import re
|
5 |
-
|
6 |
-
username = "QIN2DIM"
|
7 |
-
repo = "hcaptcha-challenger"
|
8 |
-
|
9 |
-
url = f"https://api.github.com/repos/{username}/{repo}/releases"
|
10 |
-
models_dir = "/usr/local/lib/python3.11/lib/site-packages/hcaptcha_challenger/onnx/models/"
|
11 |
-
|
12 |
-
|
13 |
-
def download_all():
|
14 |
-
session = requests.session()
|
15 |
-
response = session.get(url)
|
16 |
-
data = response.json()
|
17 |
-
os.makedirs(models_dir, exist_ok=True)
|
18 |
-
for i in data:
|
19 |
-
for j in i['assets']:
|
20 |
-
asset_url = j['browser_download_url']
|
21 |
-
asset_name = re.sub('.*/', '', asset_url)
|
22 |
-
models_path = models_dir + asset_name
|
23 |
-
if os.path.exists(models_path):
|
24 |
-
continue
|
25 |
-
print(f'Downloading {asset_name}')
|
26 |
-
r = session.get(asset_url, stream=True)
|
27 |
-
with open(models_path, 'wb') as f:
|
28 |
-
f.write(r.content)
|
29 |
-
print("Done!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|