mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-18 07:41:03 +00:00
move downloading to python + new extension
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
|
||||
import subprocess
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import requests
|
||||
|
||||
# set cwd to script location
|
||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
@@ -51,6 +54,35 @@ def run_comfyui_setup():
|
||||
run_command(f"{venv_python} initialize_comfy_extensions.py")
|
||||
|
||||
|
||||
def install_dependencies(json_file_path='dependencies.json'):
|
||||
# Load the dependency JSON
|
||||
with open(json_file_path, 'r') as file:
|
||||
dependencies = json.load(file)
|
||||
|
||||
for dep in dependencies:
|
||||
# Extract location and URL
|
||||
location = dep['location']
|
||||
url = dep['url']
|
||||
|
||||
# Convert the location to a Path object and create parent directories if they don't exist
|
||||
path = Path(location)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if path.is_file():
|
||||
print(f"{path} is already installed")
|
||||
continue
|
||||
|
||||
# Download the file
|
||||
response = requests.get(url)
|
||||
if response.status_code == 200:
|
||||
# Write the content to the file in the specified location
|
||||
with open(path, 'wb') as file:
|
||||
file.write(response.content)
|
||||
print(f"Installed {path}")
|
||||
else:
|
||||
print(f"Failed to download {url}")
|
||||
|
||||
|
||||
def main():
|
||||
with open(json_file_path, 'r') as file:
|
||||
repos = json.load(file)
|
||||
@@ -60,6 +92,7 @@ def main():
|
||||
setup_repo(repo_info)
|
||||
|
||||
setup_venv_and_install_requirements()
|
||||
install_dependencies()
|
||||
run_comfyui_setup()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user