Socold commited on
Commit
87cd072
·
verified ·
1 Parent(s): 6c24c57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -8
app.py CHANGED
@@ -1,14 +1,56 @@
1
  import os
2
- import gradio as gr
 
 
 
 
 
 
 
 
 
 
3
 
 
 
 
4
  USERNAME = os.environ.get("AUTH_USERNAME")
5
  PASSWORD = os.environ.get("AUTH_PASSWORD")
6
 
7
- print(f"Username: {USERNAME}")
8
- print(f"Password: {'*' * len(PASSWORD) if PASSWORD else 'NONE'}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
- gr.Interface(
11
- fn=lambda x: f"Test auth: {x}",
12
- inputs="text",
13
- outputs="text"
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()