lainlives commited on
Commit
eb60db8
·
1 Parent(s): 1c3abc6
Files changed (1) hide show
  1. main/app/app.py +46 -46
main/app/app.py CHANGED
@@ -458,52 +458,52 @@ index_path_dump_path = os.path.join("assets", "logs")
458
  weights_path_dump_path = os.path.join("assets", "weights")
459
  uvr_dump_path = os.path.join("assets", "models", "uvr5")
460
 
461
-
462
- repo_id = "lainlives/voice"
463
- hf_token = os.environ.get("HF_TOKEN")
464
- snapshot_download(
465
- repo_id=repo_id,
466
- repo_type="model",
467
- # allow_patterns expects a list or string pattern.
468
- # If you want everything inside 'voice_models', you might need "**/voice_models/**/*"
469
- # or be more specific. Let's assume f-string was intended incorrectly.
470
- # Let's use a pattern that should download the contents into dump_path correctly.
471
- # The download will put things inside dump_path.
472
- # We expect 'rvc/voice_models/' to appear inside dump_path.
473
- allow_patterns="rvc/voice_models/**/*", # Pattern relative to the repo root
474
- local_dir=dump_path,
475
- token=hf_token,
476
- )
477
-
478
-
479
- # Move_files_by_extension(dump_path, index_path_dump_path, weights_path_dump_path)
480
- # Create destination directories if they don't exist
481
- index_path_dump_path.mkdir(parents=True, exist_ok=True)
482
- weights_path_dump_path.mkdir(parents=True, exist_ok=True)
483
-
484
- # 1. Move .index files
485
- # Use rglob for recursive search in all subdirectories
486
- for file_path in real_dump.rglob("*.index"):
487
- try:
488
- destination = index_path_dump_path / file_path.name
489
- shutil.move(str(file_path), str(destination))
490
- print(f"Moved '{file_path.name}' to '{index_path}'")
491
- except shutil.Error as e:
492
- print(f"Error moving file {file_path}: {e}")
493
- except FileNotFoundError as e:
494
- print(f"File not found {file_path}: {e}")
495
-
496
- # 2. Move .pth files
497
- for file_path in real_dump.rglob("*.pth"):
498
- try:
499
- destination = weights_path_dump_path / file_path.name
500
- shutil.move(str(file_path), str(destination))
501
- print(f"Moved '{file_path.name}' to '{weights_path}'")
502
- except shutil.Error as e:
503
- print(f"Error moving file {file_path}: {e}")
504
- except FileNotFoundError as e:
505
- print(f"File not found {file_path}: {e}")
506
-
507
 
508
  theme_file = os.path.join("assets", "theme", default_theme + ".json")
509
  gradiotheme = gr.Theme.load(theme_file)
 
458
  weights_path_dump_path = os.path.join("assets", "weights")
459
  uvr_dump_path = os.path.join("assets", "models", "uvr5")
460
 
461
+ #
462
+ # repo_id = "lainlives/voice"
463
+ # hf_token = os.environ.get("HF_TOKEN")
464
+ # snapshot_download(
465
+ # repo_id=repo_id,
466
+ # repo_type="model",
467
+ # # allow_patterns expects a list or string pattern.
468
+ # # If you want everything inside 'voice_models', you might need "**/voice_models/**/*"
469
+ # # or be more specific. Let's assume f-string was intended incorrectly.
470
+ # # Let's use a pattern that should download the contents into dump_path correctly.
471
+ # # The download will put things inside dump_path.
472
+ # # We expect 'rvc/voice_models/' to appear inside dump_path.
473
+ # allow_patterns="rvc/voice_models/**/*", # Pattern relative to the repo root
474
+ # local_dir=dump_path,
475
+ # token=hf_token,
476
+ # )
477
+ #
478
+ #
479
+ # # Move_files_by_extension(dump_path, index_path_dump_path, weights_path_dump_path)
480
+ # # Create destination directories if they don't exist
481
+ # index_path_dump_path.mkdir(parents=True, exist_ok=True)
482
+ # weights_path_dump_path.mkdir(parents=True, exist_ok=True)
483
+ #
484
+ # # 1. Move .index files
485
+ # # Use rglob for recursive search in all subdirectories
486
+ # for file_path in real_dump.rglob("*.index"):
487
+ # try:
488
+ # destination = index_path_dump_path / file_path.name
489
+ # shutil.move(str(file_path), str(destination))
490
+ # print(f"Moved '{file_path.name}' to '{index_path}'")
491
+ # except shutil.Error as e:
492
+ # print(f"Error moving file {file_path}: {e}")
493
+ # except FileNotFoundError as e:
494
+ # print(f"File not found {file_path}: {e}")
495
+ #
496
+ # # 2. Move .pth files
497
+ # for file_path in real_dump.rglob("*.pth"):
498
+ # try:
499
+ # destination = weights_path_dump_path / file_path.name
500
+ # shutil.move(str(file_path), str(destination))
501
+ # print(f"Moved '{file_path.name}' to '{weights_path}'")
502
+ # except shutil.Error as e:
503
+ # print(f"Error moving file {file_path}: {e}")
504
+ # except FileNotFoundError as e:
505
+ # print(f"File not found {file_path}: {e}")
506
+ #
507
 
508
  theme_file = os.path.join("assets", "theme", default_theme + ".json")
509
  gradiotheme = gr.Theme.load(theme_file)