Update app.py
Browse files
app.py
CHANGED
|
@@ -6,52 +6,36 @@ import sys
|
|
| 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",
|
| 14 |
"torch", "transformers>=4.40.0", "accelerate", "gradio>=4.0.0",
|
| 15 |
"soundfile", "librosa", "scipy", "numpy", "ffmpeg-python"])
|
| 16 |
|
| 17 |
-
# Installer le projet
|
| 18 |
subprocess.run([sys.executable, "-m", "pip", "install", "-e", "VV_Clone_1"])
|
| 19 |
|
| 20 |
import torch
|
| 21 |
import gradio as gr
|
| 22 |
from demo.gradio_demo import VibeVoiceDemo
|
| 23 |
|
| 24 |
-
# Configuration
|
| 25 |
MODEL_PATH = "aoi-ot/VibeVoice-Large"
|
| 26 |
-
|
| 27 |
USERNAME = "socold01"
|
| 28 |
PASSWORD = "V#ztdUeS4Zp$0Z4ZB^y3DWhJ"
|
| 29 |
|
| 30 |
-
print(f"GPU
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
)
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
auth=(USERNAME, PASSWORD),
|
| 46 |
-
server_name="0.0.0.0",
|
| 47 |
-
share=False
|
| 48 |
-
)
|
| 49 |
-
except Exception as e:
|
| 50 |
-
print(f"Erreur: {e}")
|
| 51 |
-
import traceback
|
| 52 |
-
traceback.print_exc()
|
| 53 |
-
|
| 54 |
-
# Interface de fallback
|
| 55 |
-
def error_fn(text):
|
| 56 |
-
return f"Erreur: {e}"
|
| 57 |
-
gr.Interface(fn=error_fn, inputs="text", outputs="text", title="VibeVoice - Erreur").launch()
|
|
|
|
| 6 |
if not os.path.exists("VV_Clone_1"):
|
| 7 |
subprocess.run(["git", "clone", "https://github.com/Socold/VV_Clone_1.git"])
|
| 8 |
|
|
|
|
| 9 |
sys.path.insert(0, "VV_Clone_1")
|
| 10 |
|
| 11 |
+
# Installer les dépendances
|
| 12 |
subprocess.run([sys.executable, "-m", "pip", "install", "-q",
|
| 13 |
"torch", "transformers>=4.40.0", "accelerate", "gradio>=4.0.0",
|
| 14 |
"soundfile", "librosa", "scipy", "numpy", "ffmpeg-python"])
|
| 15 |
|
|
|
|
| 16 |
subprocess.run([sys.executable, "-m", "pip", "install", "-e", "VV_Clone_1"])
|
| 17 |
|
| 18 |
import torch
|
| 19 |
import gradio as gr
|
| 20 |
from demo.gradio_demo import VibeVoiceDemo
|
| 21 |
|
| 22 |
+
# Configuration
|
| 23 |
MODEL_PATH = "aoi-ot/VibeVoice-Large"
|
|
|
|
| 24 |
USERNAME = "socold01"
|
| 25 |
PASSWORD = "V#ztdUeS4Zp$0Z4ZB^y3DWhJ"
|
| 26 |
|
| 27 |
+
print(f"GPU: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'CPU'}")
|
| 28 |
+
print(f"VRAM: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB")
|
| 29 |
+
|
| 30 |
+
# Créer l'instance et la lancer DIRECTEMENT
|
| 31 |
+
demo_instance = VibeVoiceDemo(
|
| 32 |
+
model_path=MODEL_PATH,
|
| 33 |
+
device="cuda" if torch.cuda.is_available() else "cpu"
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
# Lancer directement avec l'authentification
|
| 37 |
+
demo_instance.launch(
|
| 38 |
+
auth=(USERNAME, PASSWORD),
|
| 39 |
+
server_name="0.0.0.0",
|
| 40 |
+
share=False
|
| 41 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|