yerang commited on
Commit
96e7a33
โ€ข
1 Parent(s): eaeac78

Upload temp.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. temp.py +7 -13
temp.py CHANGED
@@ -17,7 +17,7 @@
17
 
18
 
19
  import os
20
- from huggingface_hub import HfApi, upload_file
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
- # Hugging Face API ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ
31
- api = HfApi()
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
- if file not in exclude_files: # ์ œ์™ธํ•  ํŒŒ์ผ ํ•„ํ„ฐ๋ง
45
- full_path = os.path.join(root, file)
 
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