Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ subprocess.run([sys.executable, "-m", "pip", "install", "-q",
|
|
| 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 |
|
|
@@ -31,11 +31,10 @@ 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)
|
| 39 |
print("🔒 AUTHENTIFICATION FORCÉE APPLIQUÉE")
|
| 40 |
return original_launch(self, *args, **kwargs)
|
| 41 |
|
|
@@ -43,14 +42,17 @@ def forced_auth_launch(self, *args, **kwargs):
|
|
| 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 |
-
#
|
| 54 |
from demo.gradio_demo import main
|
| 55 |
print("🚀 Lancement de VibeVoice avec authentification forcée...")
|
| 56 |
main()
|
|
|
|
| 13 |
|
| 14 |
subprocess.run([sys.executable, "-m", "pip", "install", "-e", "VV_Clone_1"])
|
| 15 |
|
| 16 |
+
# Récupérer les secrets AVANT tout
|
| 17 |
USERNAME = os.environ.get("AUTH_USERNAME")
|
| 18 |
PASSWORD = os.environ.get("AUTH_PASSWORD")
|
| 19 |
|
|
|
|
| 31 |
|
| 32 |
# Créer une nouvelle méthode qui force l'auth
|
| 33 |
def forced_auth_launch(self, *args, **kwargs):
|
|
|
|
| 34 |
kwargs['auth'] = (USERNAME, PASSWORD)
|
| 35 |
kwargs['auth_message'] = "Authentification VibeVoice requise"
|
| 36 |
kwargs['server_name'] = "0.0.0.0"
|
| 37 |
+
kwargs.pop('share', None)
|
| 38 |
print("🔒 AUTHENTIFICATION FORCÉE APPLIQUÉE")
|
| 39 |
return original_launch(self, *args, **kwargs)
|
| 40 |
|
|
|
|
| 42 |
gr.Blocks.launch = forced_auth_launch
|
| 43 |
gr.Interface.launch = forced_auth_launch
|
| 44 |
|
|
|
|
| 45 |
import torch
|
| 46 |
print(f"GPU: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'CPU'}")
|
| 47 |
|
| 48 |
+
# IMPORTANT: Changer de dossier AVANT l'import
|
| 49 |
os.chdir("VV_Clone_1")
|
| 50 |
+
sys.path.insert(0, os.getcwd())
|
| 51 |
+
|
| 52 |
+
# Configurer les arguments
|
| 53 |
sys.argv = ["gradio_demo.py", "--model_path", "aoi-ot/VibeVoice-7B"]
|
| 54 |
|
| 55 |
+
# MAINTENANT importer après être dans le bon dossier
|
| 56 |
from demo.gradio_demo import main
|
| 57 |
print("🚀 Lancement de VibeVoice avec authentification forcée...")
|
| 58 |
main()
|