Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1175,6 +1175,59 @@ def main():
|
|
1175 |
print(f"β Server error: {e}")
|
1176 |
raise
|
1177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1179 |
if __name__ == "__main__":
|
1180 |
-
|
|
|
|
|
|
1175 |
print(f"β Server error: {e}")
|
1176 |
raise
|
1177 |
|
1178 |
+
def run_demo(
|
1179 |
+
model_path: str = "microsoft/VibeVoice-1.5B",
|
1180 |
+
device: str = "cuda",
|
1181 |
+
inference_steps: int = 30,
|
1182 |
+
share: bool = True,
|
1183 |
+
) -> None:
|
1184 |
+
"""
|
1185 |
+
Run the VibeVoice demo without any command-line arguments.
|
1186 |
+
- share=True exposes the app publicly via a Gradio share link.
|
1187 |
+
- Default Gradio port (7860) is used automatically.
|
1188 |
+
- Errors are shown to help with debugging.
|
1189 |
+
"""
|
1190 |
+
set_seed(42)
|
1191 |
+
|
1192 |
+
print("ποΈ Initializing VibeVoice Demo with Streaming Support...")
|
1193 |
+
|
1194 |
+
# Initialize demo instance
|
1195 |
+
demo_instance = VibeVoiceDemo(
|
1196 |
+
model_path=model_path,
|
1197 |
+
device=device,
|
1198 |
+
inference_steps=inference_steps
|
1199 |
+
)
|
1200 |
+
|
1201 |
+
# Build UI
|
1202 |
+
interface = create_demo_interface(demo_instance)
|
1203 |
+
|
1204 |
+
# Info
|
1205 |
+
print("π Launching demo")
|
1206 |
+
print(f"π Model path: {model_path}")
|
1207 |
+
print(f"π Available voices: {len(getattr(demo_instance, 'available_voices', []))}")
|
1208 |
+
print(f"π΄ Streaming mode: ENABLED")
|
1209 |
+
print(f"π Session isolation: ENABLED")
|
1210 |
|
1211 |
+
# Launch (no server_port specified β default 7860)
|
1212 |
+
try:
|
1213 |
+
interface.queue(
|
1214 |
+
max_size=20,
|
1215 |
+
default_concurrency_limit=1
|
1216 |
+
).launch(
|
1217 |
+
share=share,
|
1218 |
+
server_name="0.0.0.0" if share else "127.0.0.1",
|
1219 |
+
show_error=True, # show full tracebacks (debug-friendly)
|
1220 |
+
show_api=False # cleaner interface
|
1221 |
+
)
|
1222 |
+
except KeyboardInterrupt:
|
1223 |
+
print("\nπ Shutting down gracefully...")
|
1224 |
+
except Exception as e:
|
1225 |
+
print(f"β Server error: {e}")
|
1226 |
+
raise
|
1227 |
+
|
1228 |
+
|
1229 |
+
# Run automatically when this file is executed (no CLI needed)
|
1230 |
if __name__ == "__main__":
|
1231 |
+
run_demo()
|
1232 |
+
|
1233 |
+
|