Socold commited on
Commit
f2f8f13
·
verified ·
1 Parent(s): 5ce66b4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -0
app.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Ajouter au path
10
+ sys.path.insert(0, "VV_Clone_1")
11
+
12
+ # Installer les dépendances
13
+ subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-r", "VV_Clone_1/requirements.txt"])
14
+
15
+ import torch
16
+ import gradio as gr
17
+ from demo.gradio_demo import VibeVoiceDemo
18
+
19
+ # Configuration pour le modèle LARGE
20
+ # MODEL_PATH = "microsoft/VibeVoice-1.5B" # Commencez avec celui-ci
21
+ MODEL_PATH = "aoi-ot/VibeVoice-Large" # Le modèle Large directement
22
+
23
+ USERNAME = "socold01"
24
+ PASSWORD = "V#ztdUeS4Zp$0Z4ZB^y3DWhJ"
25
+
26
+ print(f"GPU disponible: {torch.cuda.is_available()}")
27
+ if torch.cuda.is_available():
28
+ print(f"GPU: {torch.cuda.get_device_name(0)}")
29
+ print(f"VRAM: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB")
30
+
31
+ # Créer et lancer l'app
32
+ try:
33
+ demo = VibeVoiceDemo(
34
+ model_path=MODEL_PATH,
35
+ device="cuda" if torch.cuda.is_available() else "cpu",
36
+ torch_dtype=torch.float16 # Optimisation mémoire
37
+ )
38
+
39
+ interface = demo.create_interface()
40
+ interface.launch(
41
+ auth=(USERNAME, PASSWORD),
42
+ server_name="0.0.0.0",
43
+ share=False
44
+ )
45
+ except Exception as e:
46
+ print(f"Erreur: {e}")
47
+ # Interface de fallback
48
+ def error_fn(text):
49
+ return f"Erreur de chargement: {e}\nVérifiez les logs"
50
+
51
+ gr.Interface(
52
+ fn=error_fn,
53
+ inputs="text",
54
+ outputs="text",
55
+ title="VibeVoice - Erreur de chargement"
56
+ ).launch()