Upload temp.py with huggingface_hub
Browse files
temp.py
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
|
18 |
|
19 |
import os
|
20 |
-
from huggingface_hub import
|
21 |
from tqdm import tqdm
|
22 |
|
23 |
# Hugging Face ํ ํฐ์ ํ๊ฒฝ ๋ณ์๋ก ์ค์
|
@@ -27,22 +27,16 @@ hf_token = os.getenv("HF_TOKEN")
|
|
27 |
folder_path = "." # ํ์ฌ ๋๋ ํ ๋ฆฌ
|
28 |
repo_id = "yerang/txt2liveportrait" # ๋ฆฌํฌ์งํ ๋ฆฌ ID
|
29 |
|
30 |
-
#
|
31 |
-
|
32 |
|
33 |
-
#
|
34 |
-
exclude_dirs = {".git", ".ipynb_checkpoints"}
|
35 |
-
exclude_files = {".gitignore", ".gitattributes", ".gitmodules"}
|
36 |
-
|
37 |
-
# ํ์ผ ๋ชฉ๋ก ๊ฐ์ ธ์ค๊ธฐ (ํํฐ๋ง ํฌํจ)
|
38 |
file_paths = []
|
39 |
for root, dirs, files in os.walk(folder_path):
|
40 |
-
# ์ ์ธํ ๋๋ ํ ๋ฆฌ๋ฅผ ํ์ ๋์์์ ์ ์ธ
|
41 |
-
dirs[:] = [d for d in dirs if d not in exclude_dirs]
|
42 |
-
|
43 |
for file in files:
|
44 |
-
|
45 |
-
|
|
|
46 |
rel_path_in_repo = os.path.relpath(full_path, folder_path)
|
47 |
file_paths.append((full_path, rel_path_in_repo))
|
48 |
|
|
|
17 |
|
18 |
|
19 |
import os
|
20 |
+
from huggingface_hub import upload_file
|
21 |
from tqdm import tqdm
|
22 |
|
23 |
# Hugging Face ํ ํฐ์ ํ๊ฒฝ ๋ณ์๋ก ์ค์
|
|
|
27 |
folder_path = "." # ํ์ฌ ๋๋ ํ ๋ฆฌ
|
28 |
repo_id = "yerang/txt2liveportrait" # ๋ฆฌํฌ์งํ ๋ฆฌ ID
|
29 |
|
30 |
+
# ์ ์ธํ ํ์ผ ํฌ๊ธฐ (๋จ์: ๋ฐ์ดํธ, ์ฌ๊ธฐ์๋ 100MB ์ด์์ธ ํ์ผ์ ์ ์ธ)
|
31 |
+
max_file_size = 100 * 1024 * 1024 # 100MB
|
32 |
|
33 |
+
# ํ์ผ ๋ชฉ๋ก ๊ฐ์ ธ์ค๊ธฐ (ํฐ ํ์ผ ์ ์ธ)
|
|
|
|
|
|
|
|
|
34 |
file_paths = []
|
35 |
for root, dirs, files in os.walk(folder_path):
|
|
|
|
|
|
|
36 |
for file in files:
|
37 |
+
full_path = os.path.join(root, file)
|
38 |
+
# ํ์ผ ํฌ๊ธฐ ํ์ธ
|
39 |
+
if os.path.getsize(full_path) < max_file_size: # ์ค์ ํ ํฌ๊ธฐ ์ดํ์ธ ํ์ผ๋ง ์ถ๊ฐ
|
40 |
rel_path_in_repo = os.path.relpath(full_path, folder_path)
|
41 |
file_paths.append((full_path, rel_path_in_repo))
|
42 |
|