Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,56 @@
|
|
| 1 |
import os
|
| 2 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
USERNAME = os.environ.get("AUTH_USERNAME")
|
| 5 |
PASSWORD = os.environ.get("AUTH_PASSWORD")
|
| 6 |
|
| 7 |
-
|
| 8 |
-
print(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
).launch(auth=(USERNAME, PASSWORD) if USERNAME else None)
|
|
|
|
| 1 |
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
# Cloner votre repository
|
| 6 |
+
if not os.path.exists("VV_Clone_1"):
|
| 7 |
+
subprocess.run(["git", "clone", "https://github.com/Socold/VV_Clone_1.git"])
|
| 8 |
+
|
| 9 |
+
# Installer les dépendances
|
| 10 |
+
subprocess.run([sys.executable, "-m", "pip", "install", "-q",
|
| 11 |
+
"torch", "transformers>=4.40.0", "accelerate", "gradio>=4.0.0",
|
| 12 |
+
"soundfile", "librosa", "scipy", "numpy", "ffmpeg-python"])
|
| 13 |
|
| 14 |
+
subprocess.run([sys.executable, "-m", "pip", "install", "-e", "VV_Clone_1"])
|
| 15 |
+
|
| 16 |
+
# Récupérer les secrets
|
| 17 |
USERNAME = os.environ.get("AUTH_USERNAME")
|
| 18 |
PASSWORD = os.environ.get("AUTH_PASSWORD")
|
| 19 |
|
| 20 |
+
if not USERNAME or not PASSWORD:
|
| 21 |
+
print("❌ ERREUR: Configurez AUTH_USERNAME et AUTH_PASSWORD dans Settings!")
|
| 22 |
+
exit(1)
|
| 23 |
+
|
| 24 |
+
print(f"✅ Authentification activée pour: {USERNAME}")
|
| 25 |
+
|
| 26 |
+
# FORCER l'authentification en modifiant Gradio
|
| 27 |
+
import gradio as gr
|
| 28 |
+
|
| 29 |
+
# Sauvegarder la méthode originale
|
| 30 |
+
original_launch = gr.Blocks.launch
|
| 31 |
+
|
| 32 |
+
# Créer une nouvelle méthode qui force l'auth
|
| 33 |
+
def forced_auth_launch(self, *args, **kwargs):
|
| 34 |
+
# Toujours forcer l'authentification
|
| 35 |
+
kwargs['auth'] = (USERNAME, PASSWORD)
|
| 36 |
+
kwargs['auth_message'] = "Authentification VibeVoice requise"
|
| 37 |
+
kwargs['server_name'] = "0.0.0.0"
|
| 38 |
+
kwargs.pop('share', None) # Retirer share qui cause des problèmes
|
| 39 |
+
print("🔒 AUTHENTIFICATION FORCÉE APPLIQUÉE")
|
| 40 |
+
return original_launch(self, *args, **kwargs)
|
| 41 |
+
|
| 42 |
+
# Remplacer la méthode launch
|
| 43 |
+
gr.Blocks.launch = forced_auth_launch
|
| 44 |
+
gr.Interface.launch = forced_auth_launch
|
| 45 |
+
|
| 46 |
+
# Maintenant lancer le script normal
|
| 47 |
+
import torch
|
| 48 |
+
print(f"GPU: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'CPU'}")
|
| 49 |
+
|
| 50 |
+
os.chdir("VV_Clone_1")
|
| 51 |
+
sys.argv = ["gradio_demo.py", "--model_path", "aoi-ot/VibeVoice-7B"]
|
| 52 |
|
| 53 |
+
# Importer et lancer
|
| 54 |
+
from demo.gradio_demo import main
|
| 55 |
+
print("🚀 Lancement de VibeVoice avec authentification forcée...")
|
| 56 |
+
main()
|
|
|