Skip to content

Commit

Permalink
fixed installer
Browse files Browse the repository at this point in the history
  • Loading branch information
s0md3v authored Jun 18, 2023
1 parent 15d95f1 commit 27e185a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@
import os
import pkg_resources
import sys
import traceback
from tqdm import tqdm
import urllib.request

req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")

import os

models_dir = os.path.abspath("models/roop")
model_url = "https://huggingface.co/henryruhs/roop/resolve/main/inswapper_128.onnx"
model_name = os.path.basename(model_url)
model_path = os.path.join(models_dir, model_name)

def download(url, path):
request = urllib.request.urlopen(url)
total = int(request.headers.get('Content-Length', 0))
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
urllib.request.urlretrieve(url, path, reporthook=lambda count, block_size, total_size: progress.update(block_size))

if not os.path.exists(models_dir):
os.makedirs(models_dir)
print(f"roop : You can put the model in {models_dir} directory")

print("Check roop requirements")
if not os.path.exists(model_path):
download(model_url, model_path)

print("Checking roop requirements")
with open(req_file) as file:
for package in file:
try:
Expand Down

0 comments on commit 27e185a

Please sign in to comment.