Spaces:
Running
Running
no no
Browse files
app.py
CHANGED
|
@@ -1,11 +1,16 @@
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
-
#
|
|
|
|
| 4 |
os.environ["GRADIO_LAUNCH_METHOD"] = "headless"
|
| 5 |
os.environ["GRADIO_SKIP_JS_SETUP"] = "1"
|
| 6 |
os.environ["GRADIO_ALLOW_LEGACY_NODE_LAUNCH"] = "1"
|
| 7 |
os.environ["GRADIO_NODE_LAUNCH_METHOD"] = "legacy"
|
| 8 |
os.environ["GRADIO_DISABLE_ANALYTICS"] = "1"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
import random
|
| 10 |
import numpy as np
|
| 11 |
import torch
|
|
@@ -13,9 +18,9 @@ from src.chatterbox.mtl_tts import ChatterboxMultilingualTTS, SUPPORTED_LANGUAGE
|
|
| 13 |
import gradio as gr
|
| 14 |
import spaces
|
| 15 |
|
| 16 |
-
#
|
| 17 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 18 |
-
print(f"
|
| 19 |
|
| 20 |
# --- Global Model Cache ---
|
| 21 |
MODEL = None
|
|
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
+
# 🚫 Fix for Hugging Face Spaces (T4 GPU) Node.js error:
|
| 4 |
+
# Prevents `/usr/bin/node: bad option: --import` by disabling Node UI spawning
|
| 5 |
os.environ["GRADIO_LAUNCH_METHOD"] = "headless"
|
| 6 |
os.environ["GRADIO_SKIP_JS_SETUP"] = "1"
|
| 7 |
os.environ["GRADIO_ALLOW_LEGACY_NODE_LAUNCH"] = "1"
|
| 8 |
os.environ["GRADIO_NODE_LAUNCH_METHOD"] = "legacy"
|
| 9 |
os.environ["GRADIO_DISABLE_ANALYTICS"] = "1"
|
| 10 |
+
|
| 11 |
+
# Optional: force CPU-safe start until GPU ready (for smoother init)
|
| 12 |
+
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.6"
|
| 13 |
+
|
| 14 |
import random
|
| 15 |
import numpy as np
|
| 16 |
import torch
|
|
|
|
| 18 |
import gradio as gr
|
| 19 |
import spaces
|
| 20 |
|
| 21 |
+
# ✅ Detect CUDA
|
| 22 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 23 |
+
print(f"✅ Model ready on {DEVICE}")
|
| 24 |
|
| 25 |
# --- Global Model Cache ---
|
| 26 |
MODEL = None
|