| |
| |
| |
| |
| |
| |
| |
|
|
| import os |
| import subprocess |
| import sys |
| from pathlib import Path |
|
|
| |
| DEPS_DIR = Path("/data") |
|
|
| |
| REPOS_TO_CLONE = { |
| "LTX-Video": "https://huggingface.co/spaces/Lightricks/ltx-video-distilled", |
| "SeedVR_Space": "https://huggingface.co/spaces/ByteDance-Seed/SeedVR2-3B", |
| "MMAudio": "https://github.com/hkchengrex/MMAudio.git" |
| } |
|
|
| def run_command(command, cwd=None): |
| """Executa um comando no terminal e lida com erros.""" |
| print(f"Executando: {' '.join(command)}") |
| try: |
| |
| subprocess.run( |
| command, |
| check=True, |
| cwd=cwd, |
| stdin=subprocess.DEVNULL, |
| ) |
| except subprocess.CalledProcessError as e: |
| print(f"ERRO: O comando falhou com o código de saída {e.returncode}") |
| |
| print(f"Stderr: {e.stderr}") |
| sys.exit(1) |
| except FileNotFoundError: |
| print(f"ERRO: O comando '{command[0]}' não foi encontrado. Certifique-se de que o git está instalado e no seu PATH.") |
| sys.exit(1) |
|
|
| def main(): |
| print("--- Iniciando Setup do Ambiente ADUC-SDR ---") |
| |
| DEPS_DIR.mkdir(exist_ok=True) |
| |
| for repo_name, repo_url in REPOS_TO_CLONE.items(): |
| repo_path = DEPS_DIR / repo_name |
| if repo_path.exists(): |
| print(f"Repositório '{repo_name}' já existe. Pulando a clonagem.") |
| else: |
| print(f"Clonando '{repo_name}' de {repo_url}...") |
| run_command(["git", "clone", "--depth", "1", repo_url, str(repo_path)]) |
| print(f"'{repo_name}' clonado com sucesso.") |
|
|
| print("\n--- Setup do Ambiente Concluído com Sucesso! ---") |
| print("Você agora pode iniciar a aplicação principal (ex: python app.py).") |
|
|
| if __name__ == "__main__": |
| main() |
| |