Lydia05 commited on
Commit
b66e575
·
verified ·
1 Parent(s): ff066c1

自动选 cpu/cuda + 关掉 share

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -440,11 +440,13 @@ def run_demo(
440
  model_paths: dict = None,
441
  device: str = "cuda",
442
  inference_steps: int = 5,
443
- share: bool = True,
444
  ):
445
  """
446
  model_paths default includes two entries. Replace paths as needed.
447
  """
 
 
448
  if model_paths is None:
449
  model_paths = {
450
  "VibeVoice-Large":"aoi-ot/VibeVoice-Large", # "microsoft/VibeVoice-Large",
@@ -456,8 +458,8 @@ def run_demo(
456
  demo_instance = VibeVoiceDemo(model_paths, device, inference_steps)
457
  interface = create_demo_interface(demo_instance)
458
  interface.queue().launch(
459
- share=share,
460
- server_name="0.0.0.0" if share else "127.0.0.1",
461
  show_error=True,
462
  show_api=False
463
  )
 
440
  model_paths: dict = None,
441
  device: str = "cuda",
442
  inference_steps: int = 5,
443
+
444
  ):
445
  """
446
  model_paths default includes two entries. Replace paths as needed.
447
  """
448
+ device = "cuda" if torch.cuda.is_available() else "cpu"
449
+
450
  if model_paths is None:
451
  model_paths = {
452
  "VibeVoice-Large":"aoi-ot/VibeVoice-Large", # "microsoft/VibeVoice-Large",
 
458
  demo_instance = VibeVoiceDemo(model_paths, device, inference_steps)
459
  interface = create_demo_interface(demo_instance)
460
  interface.queue().launch(
461
+ share=False,
462
+ server_name="0.0.0.0",
463
  show_error=True,
464
  show_api=False
465
  )