tori29umai commited on
Commit
9c9bde8
1 Parent(s): 0d4b0ba

Update utils/dl_utils.py

Browse files
Files changed (1) hide show
  1. utils/dl_utils.py +18 -12
utils/dl_utils.py CHANGED
@@ -57,16 +57,22 @@ def dl_tagger_model(model_dir):
57
 
58
 
59
  def dl_lora_model(model_dir):
60
- file_name = 'syoujomannga_line.safetensors'
61
- file_path = os.path.join(model_dir, file_name)
62
- if not os.path.exists(file_path):
63
- url = "https://huggingface.co/tori29umai/Egara_Lora/resolve/main/syoujomannga_line.safetensors"
64
- response = requests.get(url, allow_redirects=True)
65
- if response.status_code == 200:
66
- with open(file_path, 'wb') as f:
67
- f.write(response.content)
68
- print(f'Downloaded {file_name}')
 
 
 
 
 
 
 
 
69
  else:
70
- print(f'Failed to download {file_name}')
71
- else:
72
- print(f'{file_name} already exists.')
 
57
 
58
 
59
  def dl_lora_model(model_dir):
60
+ models = {
61
+ "syoujomannga_line.safetensors": "https://huggingface.co/tori29umai/Egara_Lora/resolve/main/syoujomannga_line.safetensors",
62
+ "tori29umai_line.safetensors": "https://huggingface.co/tori29umai/Egara_Lora/resolve/main/tori29umai_line.safetensors",
63
+ # "gekiga_line.safetensors": "https://huggingface.co/tori29umai/Egara_Lora/resolve/main/gekiga_line.safetensors"
64
+ }
65
+
66
+ # 各モデルを確認し、必要に応じてダウンロード
67
+ for file_name, url in models.items():
68
+ file_path = os.path.join(model_dir, file_name)
69
+ if not os.path.exists(file_path):
70
+ response = requests.get(url, allow_redirects=True)
71
+ if response.status_code == 200:
72
+ with open(file_path, 'wb') as f:
73
+ f.write(response.content)
74
+ print(f'Downloaded {file_name}')
75
+ else:
76
+ print(f'Failed to download {file_name}')
77
  else:
78
+ print(f'{file_name} already exists.')