Vgjkmhf commited on
Commit
ab6aa32
·
verified ·
1 Parent(s): 54f012e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -38
app.py CHANGED
@@ -66,7 +66,7 @@ for url, filename in zip(test_model.split(", "), test_names):
66
 
67
  title = "<center><strong><font size='7'>RVC⚡ZERO</font></strong></center>"
68
  description = "This demo is provided for educational and research purposes only. The authors and contributors of this project do not endorse or encourage any misuse or unethical use of this software. Any use of this software for purposes other than those intended is solely at the user's own risk. The authors and contributors shall not be held responsible for any damages or liabilities arising from the use of this demo inappropriately." if IS_ZERO_GPU else ""
69
- RESOURCES = "- You can also try `RVC⚡ZERO` in Colabs free tier, which provides free GPU [link](https://github.com/R3gm/rvc_zero_ui?tab=readme-ov-file#rvczero)."
70
  theme = args.theme
71
  delete_cache_time = (3200, 3200) if IS_ZERO_GPU else (86400, 86400)
72
 
@@ -367,7 +367,7 @@ def run(
367
  steps,
368
  ):
369
  if not audio_files:
370
- raise ValueError("The audio pls")
371
 
372
  if isinstance(audio_files, str):
373
  audio_files = [audio_files]
@@ -411,7 +411,7 @@ def run(
411
 
412
  def audio_conf():
413
  return gr.File(
414
- label="Audio files",
415
  file_count="multiple",
416
  type="filepath",
417
  container=True,
@@ -420,9 +420,10 @@ def audio_conf():
420
 
421
  def model_conf():
422
  return gr.File(
423
- label="Model file",
424
  type="filepath",
425
  height=130,
 
426
  )
427
 
428
 
@@ -430,7 +431,7 @@ def pitch_algo_conf():
430
  return gr.Dropdown(
431
  PITCH_ALGO_OPT,
432
  value=PITCH_ALGO_OPT[4],
433
- label="Pitch algorithm",
434
  visible=True,
435
  interactive=True,
436
  )
@@ -438,7 +439,7 @@ def pitch_algo_conf():
438
 
439
  def pitch_lvl_conf():
440
  return gr.Slider(
441
- label="Pitch level",
442
  minimum=-24,
443
  maximum=24,
444
  step=1,
@@ -450,9 +451,10 @@ def pitch_lvl_conf():
450
 
451
  def index_conf():
452
  return gr.File(
453
- label="Index file",
454
  type="filepath",
455
  height=130,
 
456
  )
457
 
458
 
@@ -460,7 +462,7 @@ def index_inf_conf():
460
  return gr.Slider(
461
  minimum=0,
462
  maximum=1,
463
- label="Index influence",
464
  value=0.75,
465
  )
466
 
@@ -469,7 +471,7 @@ def respiration_filter_conf():
469
  return gr.Slider(
470
  minimum=0,
471
  maximum=7,
472
- label="Respiration median filtering",
473
  value=3,
474
  step=1,
475
  interactive=True,
@@ -480,7 +482,7 @@ def envelope_ratio_conf():
480
  return gr.Slider(
481
  minimum=0,
482
  maximum=1,
483
- label="Envelope ratio",
484
  value=0.25,
485
  interactive=True,
486
  )
@@ -490,7 +492,7 @@ def consonant_protec_conf():
490
  return gr.Slider(
491
  minimum=0,
492
  maximum=0.5,
493
- label="Consonant breath protection",
494
  value=0.5,
495
  interactive=True,
496
  )
@@ -498,14 +500,14 @@ def consonant_protec_conf():
498
 
499
  def button_conf():
500
  return gr.Button(
501
- "Inference",
502
  variant="primary",
503
  )
504
 
505
 
506
  def output_conf():
507
  return gr.File(
508
- label="Result",
509
  file_count="multiple",
510
  interactive=False,
511
  )
@@ -514,15 +516,14 @@ def output_conf():
514
  def active_tts_conf():
515
  return gr.Checkbox(
516
  False,
517
- label="TTS",
518
- # info="",
519
  container=False,
520
  )
521
 
522
 
523
  def tts_voice_conf():
524
  return gr.Dropdown(
525
- label="tts voice",
526
  choices=voices,
527
  visible=False,
528
  value="en-US-EmmaMultilingualNeural-Female",
@@ -532,8 +533,8 @@ def tts_voice_conf():
532
  def tts_text_conf():
533
  return gr.Textbox(
534
  value="",
535
- placeholder="Write the text here...",
536
- label="Text",
537
  visible=False,
538
  lines=3,
539
  )
@@ -541,7 +542,7 @@ def tts_text_conf():
541
 
542
  def tts_button_conf():
543
  return gr.Button(
544
- "Process TTS",
545
  variant="secondary",
546
  visible=False,
547
  )
@@ -550,8 +551,7 @@ def tts_button_conf():
550
  def tts_play_conf():
551
  return gr.Checkbox(
552
  False,
553
- label="Play",
554
- # info="",
555
  container=False,
556
  visible=False,
557
  )
@@ -561,7 +561,6 @@ def sound_gui():
561
  return gr.Audio(
562
  value=None,
563
  type="filepath",
564
- # format="mp3",
565
  autoplay=True,
566
  visible=True,
567
  interactive=False,
@@ -573,7 +572,7 @@ def steps_conf():
573
  return gr.Slider(
574
  minimum=1,
575
  maximum=3,
576
- label="Steps",
577
  value=1,
578
  step=1,
579
  interactive=True,
@@ -582,7 +581,7 @@ def steps_conf():
582
 
583
  def format_output_gui():
584
  return gr.Dropdown(
585
- label="Format output:",
586
  choices=["wav", "mp3", "flac"],
587
  value="wav",
588
  )
@@ -590,8 +589,7 @@ def format_output_gui():
590
  def denoise_conf():
591
  return gr.Checkbox(
592
  False,
593
- label="Denoise",
594
- # info="",
595
  container=False,
596
  visible=True,
597
  )
@@ -600,8 +598,7 @@ def denoise_conf():
600
  def effects_conf():
601
  return gr.Checkbox(
602
  False,
603
- label="Reverb",
604
- # info="",
605
  container=False,
606
  visible=True,
607
  )
@@ -636,8 +633,7 @@ def show_components_tts(value_active):
636
  def down_active_conf():
637
  return gr.Checkbox(
638
  False,
639
- label="URL-to-Model",
640
- # info="",
641
  container=False,
642
  )
643
 
@@ -645,8 +641,8 @@ def down_active_conf():
645
  def down_url_conf():
646
  return gr.Textbox(
647
  value="",
648
- placeholder="Write the url here...",
649
- label="Enter URL",
650
  visible=False,
651
  lines=1,
652
  )
@@ -654,7 +650,7 @@ def down_url_conf():
654
 
655
  def down_button_conf():
656
  return gr.Button(
657
- "Process",
658
  variant="secondary",
659
  visible=False,
660
  )
@@ -671,7 +667,7 @@ def show_components_down(value_active):
671
 
672
  CSS = """
673
  #audio_tts {
674
- visibility: hidden; /* invisible but still takes space */
675
  height: 0px;
676
  width: 0px;
677
  max-width: 0px;
@@ -705,7 +701,6 @@ def get_gui(theme):
705
  )
706
 
707
  aud = audio_conf()
708
- # gr.HTML("<hr>")
709
 
710
  tts_button.click(
711
  fn=infer_tts_audio,
@@ -713,9 +708,12 @@ def get_gui(theme):
713
  outputs=[aud, tts_play],
714
  )
715
 
 
 
 
716
  down_active_gui = down_active_conf()
717
  down_info = gr.Markdown(
718
- f"Provide a link to a zip file, like this one: `https://huggingface.co/MrDawg/ToothBrushing/resolve/main/ToothBrushing.zip?download=true`, or separate links with a comma for the .pth and .index files, like this: `{test_model}`",
719
  visible=False
720
  )
721
  with gr.Row():
@@ -741,7 +739,7 @@ def get_gui(theme):
741
  [model, indx]
742
  )
743
 
744
- with gr.Accordion(label="Advanced settings", open=False):
745
  algo = pitch_algo_conf()
746
  algo_lvl = pitch_lvl_conf()
747
  indx_inf = index_inf_conf()
@@ -853,4 +851,4 @@ if __name__ == "__main__":
853
  quiet=False,
854
  debug=IS_COLAB,
855
  ssr_mode=False,
856
- )
 
66
 
67
  title = "<center><strong><font size='7'>RVC⚡ZERO</font></strong></center>"
68
  description = "This demo is provided for educational and research purposes only. The authors and contributors of this project do not endorse or encourage any misuse or unethical use of this software. Any use of this software for purposes other than those intended is solely at the user's own risk. The authors and contributors shall not be held responsible for any damages or liabilities arising from the use of this demo inappropriately." if IS_ZERO_GPU else ""
69
+ RESOURCES = "- You can also try `RVC⚡ZERO` in Colab's free tier, which provides free GPU [link](https://github.com/R3gm/rvc_zero_ui?tab=readme-ov-file#rvczero)."
70
  theme = args.theme
71
  delete_cache_time = (3200, 3200) if IS_ZERO_GPU else (86400, 86400)
72
 
 
367
  steps,
368
  ):
369
  if not audio_files:
370
+ raise ValueError("لطفا فایل صوتی آپلود کنید")
371
 
372
  if isinstance(audio_files, str):
373
  audio_files = [audio_files]
 
411
 
412
  def audio_conf():
413
  return gr.File(
414
+ label="فایل‌های صوتی",
415
  file_count="multiple",
416
  type="filepath",
417
  container=True,
 
420
 
421
  def model_conf():
422
  return gr.File(
423
+ label="آپلود مدل (.pth)",
424
  type="filepath",
425
  height=130,
426
+ file_types=[".pth"],
427
  )
428
 
429
 
 
431
  return gr.Dropdown(
432
  PITCH_ALGO_OPT,
433
  value=PITCH_ALGO_OPT[4],
434
+ label="الگوریتم پیچ",
435
  visible=True,
436
  interactive=True,
437
  )
 
439
 
440
  def pitch_lvl_conf():
441
  return gr.Slider(
442
+ label="سطح پیچ",
443
  minimum=-24,
444
  maximum=24,
445
  step=1,
 
451
 
452
  def index_conf():
453
  return gr.File(
454
+ label="آپلود فایل ایندکس (.index) - اختیاری",
455
  type="filepath",
456
  height=130,
457
+ file_types=[".index"],
458
  )
459
 
460
 
 
462
  return gr.Slider(
463
  minimum=0,
464
  maximum=1,
465
+ label="تاثیر ایندکس",
466
  value=0.75,
467
  )
468
 
 
471
  return gr.Slider(
472
  minimum=0,
473
  maximum=7,
474
+ label="فیلتر میانه تنفس",
475
  value=3,
476
  step=1,
477
  interactive=True,
 
482
  return gr.Slider(
483
  minimum=0,
484
  maximum=1,
485
+ label="نسبت پوششی",
486
  value=0.25,
487
  interactive=True,
488
  )
 
492
  return gr.Slider(
493
  minimum=0,
494
  maximum=0.5,
495
+ label="محافظت تنفس صامت",
496
  value=0.5,
497
  interactive=True,
498
  )
 
500
 
501
  def button_conf():
502
  return gr.Button(
503
+ "اجرای تبدیل صدا",
504
  variant="primary",
505
  )
506
 
507
 
508
  def output_conf():
509
  return gr.File(
510
+ label="نتیجه",
511
  file_count="multiple",
512
  interactive=False,
513
  )
 
516
  def active_tts_conf():
517
  return gr.Checkbox(
518
  False,
519
+ label="فعال‌سازی TTS",
 
520
  container=False,
521
  )
522
 
523
 
524
  def tts_voice_conf():
525
  return gr.Dropdown(
526
+ label="صدای TTS",
527
  choices=voices,
528
  visible=False,
529
  value="en-US-EmmaMultilingualNeural-Female",
 
533
  def tts_text_conf():
534
  return gr.Textbox(
535
  value="",
536
+ placeholder="متن خود را اینجا بنویسید...",
537
+ label="متن",
538
  visible=False,
539
  lines=3,
540
  )
 
542
 
543
  def tts_button_conf():
544
  return gr.Button(
545
+ "تولید TTS",
546
  variant="secondary",
547
  visible=False,
548
  )
 
551
  def tts_play_conf():
552
  return gr.Checkbox(
553
  False,
554
+ label="پخش",
 
555
  container=False,
556
  visible=False,
557
  )
 
561
  return gr.Audio(
562
  value=None,
563
  type="filepath",
 
564
  autoplay=True,
565
  visible=True,
566
  interactive=False,
 
572
  return gr.Slider(
573
  minimum=1,
574
  maximum=3,
575
+ label="تعداد مراحل",
576
  value=1,
577
  step=1,
578
  interactive=True,
 
581
 
582
  def format_output_gui():
583
  return gr.Dropdown(
584
+ label="فرمت خروجی:",
585
  choices=["wav", "mp3", "flac"],
586
  value="wav",
587
  )
 
589
  def denoise_conf():
590
  return gr.Checkbox(
591
  False,
592
+ label="حذف نویز",
 
593
  container=False,
594
  visible=True,
595
  )
 
598
  def effects_conf():
599
  return gr.Checkbox(
600
  False,
601
+ label="افکت‌های صوتی (Reverb)",
 
602
  container=False,
603
  visible=True,
604
  )
 
633
  def down_active_conf():
634
  return gr.Checkbox(
635
  False,
636
+ label="دانلود مدل از URL",
 
637
  container=False,
638
  )
639
 
 
641
  def down_url_conf():
642
  return gr.Textbox(
643
  value="",
644
+ placeholder="آدرس URL را اینجا وارد کنید...",
645
+ label="وارد کردن URL",
646
  visible=False,
647
  lines=1,
648
  )
 
650
 
651
  def down_button_conf():
652
  return gr.Button(
653
+ "دانلود مدل",
654
  variant="secondary",
655
  visible=False,
656
  )
 
667
 
668
  CSS = """
669
  #audio_tts {
670
+ visibility: hidden;
671
  height: 0px;
672
  width: 0px;
673
  max-width: 0px;
 
701
  )
702
 
703
  aud = audio_conf()
 
704
 
705
  tts_button.click(
706
  fn=infer_tts_audio,
 
708
  outputs=[aud, tts_play],
709
  )
710
 
711
+ gr.Markdown("### 📁 آپلود مدل")
712
+ gr.Markdown("می‌توانید فایل مدل .pth و فایل ایندکس .index را مستقیما آپلود کنید یا از URL دانلود کنید")
713
+
714
  down_active_gui = down_active_conf()
715
  down_info = gr.Markdown(
716
+ f"لینک فایل zip مانند: `https://huggingface.co/MrDawg/ToothBrushing/resolve/main/ToothBrushing.zip?download=true` یا لینک‌های جدا شده با کاما برای فایل‌های .pth و .index مانند: `{test_model}`",
717
  visible=False
718
  )
719
  with gr.Row():
 
739
  [model, indx]
740
  )
741
 
742
+ with gr.Accordion(label="تنظیمات پیشرفته", open=False):
743
  algo = pitch_algo_conf()
744
  algo_lvl = pitch_lvl_conf()
745
  indx_inf = index_inf_conf()
 
851
  quiet=False,
852
  debug=IS_COLAB,
853
  ssr_mode=False,
854
+ )