|
|
import os |
|
|
import subprocess |
|
|
import sys |
|
|
|
|
|
|
|
|
if not os.path.exists("VV_Clone_1"): |
|
|
subprocess.run(["git", "clone", "https://github.com/Socold/VV_Clone_1.git"]) |
|
|
|
|
|
sys.path.insert(0, "VV_Clone_1") |
|
|
|
|
|
|
|
|
subprocess.run([sys.executable, "-m", "pip", "install", "-q", |
|
|
"torch", "transformers>=4.40.0", "accelerate", "gradio>=4.0.0", |
|
|
"soundfile", "librosa", "scipy", "numpy", "ffmpeg-python"]) |
|
|
|
|
|
subprocess.run([sys.executable, "-m", "pip", "install", "-e", "VV_Clone_1"]) |
|
|
|
|
|
import torch |
|
|
import gradio as gr |
|
|
|
|
|
|
|
|
MODEL_PATH = "aoi-ot/VibeVoice-7B" |
|
|
|
|
|
|
|
|
USERNAME = os.environ.get("AUTH_USERNAME") |
|
|
PASSWORD = os.environ.get("AUTH_PASSWORD") |
|
|
|
|
|
print(f"Chargement du modèle: {MODEL_PATH}") |
|
|
print(f"GPU: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'CPU'}") |
|
|
print(f"VRAM disponible: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB") |
|
|
|
|
|
|
|
|
os.chdir("VV_Clone_1") |
|
|
sys.argv = ["gradio_demo.py", "--model_path", MODEL_PATH, "--share"] |
|
|
|
|
|
|
|
|
from demo.gradio_demo import main |
|
|
|
|
|
|
|
|
if USERNAME and PASSWORD: |
|
|
with open("demo/gradio_demo.py", "r") as f: |
|
|
content = f.read() |
|
|
|
|
|
|
|
|
content = content.replace( |
|
|
'demo.launch(share=args.share)', |
|
|
f'demo.launch(share=args.share, auth=("{USERNAME}", "{PASSWORD}"))' |
|
|
) |
|
|
|
|
|
with open("demo/gradio_demo.py", "w") as f: |
|
|
f.write(content) |
|
|
|
|
|
print(f"Authentification activée pour l'utilisateur: {USERNAME}") |
|
|
else: |
|
|
print("Pas d'authentification configurée (pas de secrets définis)") |
|
|
|
|
|
|
|
|
print("Démarrage de l'interface VibeVoice-7B...") |
|
|
main() |