Spaces:
Runtime error
Runtime error
File size: 945 Bytes
c3b62d3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import random
import string
import os
import requests
from tqdm import tqdm
def randomname(n):
randlst = [random.choice(string.ascii_letters + string.digits) for i in range(n)]
return ''.join(randlst)
def load_lora_model(model_dir):
folder = model_dir
file_name = 'sdxl_BWLine.safetensors'
url = "https://huggingface.co/tori29umai/lineart/resolve/main/sdxl_BWLine.safetensors"
file_path = os.path.join(folder, file_name)
if not os.path.exists(file_path):
response = requests.get(url, stream=True)
total_size = int(response.headers.get('content-length', 0))
with open(file_path, 'wb') as f, tqdm(
desc=file_name,
total=total_size,
unit='iB',
unit_scale=True,
unit_divisor=1024,
) as bar:
for data in response.iter_content(chunk_size=1024):
size = f.write(data)
bar.update(size) |