soiz1 commited on
Commit
68846d8
·
verified ·
1 Parent(s): a4abbe8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -58
app.py CHANGED
@@ -674,64 +674,6 @@ def voice_conversion(source, target, diffusion_steps, length_adjust, inference_c
674
  ).export(format="mp3", bitrate=bitrate).read()
675
  yield mp3_bytes, None
676
 
677
- import gradio as gr
678
-
679
- # ギャラリーの画像と対応するMP3ファイル
680
- gallery_data = [
681
- {
682
- "image": "default/sikokumetan.webp",
683
- "mp3": "default/sikokumetan.mp3"
684
- }
685
- ]
686
-
687
- # ギャラリーの画像が選択された際の処理
688
- def on_image_select(image_path):
689
- # 画像に対応するMP3を取得
690
- for item in gallery_data:
691
- if item["image"] == image_path:
692
- return item["mp3"]
693
- return None
694
-
695
- if __name__ == "__main__":
696
- description = ("Zero-shot音声変換モデル(学習不要)。ローカルでの利用方法は[GitHubリポジトリ](https://github.com/Plachtaa/seed-vc)をご覧ください。"
697
- "参考音声が25秒を超える場合、自動的に25秒にクリップされます。"
698
- "また、元音声と参考音声の合計時間が30秒を超える場合、元音声は分割処理されます。")
699
-
700
- inputs = [
701
- gr.Audio(type="filepath", label="元音声"),
702
- gr.Audio(type="filepath", label="参考音声"),
703
- gr.Slider(minimum=1, maximum=200, value=10, step=1, label="拡散ステップ数", info="デフォルトは10、50~100が最適な品質"),
704
- gr.Slider(minimum=0.5, maximum=2.0, step=0.1, value=1.0, label="長さ調整", info="1.0未満で速度を上げ、1.0以上で速度を遅くします"),
705
- gr.Slider(minimum=0.0, maximum=1.0, step=0.1, value=0.7, label="推論CFG率", info="わずかな影響があります"),
706
- gr.Checkbox(label="F0条件付きモデルを使用", value=False, info="歌声変換には必須です"),
707
- gr.Checkbox(label="F0自動調整", value=True, info="F0をおおよそ調整して目標音声に合わせます。F0条件付きモデル使用時にのみ有効です"),
708
- gr.Slider(label='音程変換', minimum=-24, maximum=24, step=1, value=0, info="半音単位の音程変換。F0条件付きモデル使用時にのみ有効です"),
709
- ]
710
-
711
- # ギャラリーコンポーネントの追加
712
- gallery = gr.Gallery(
713
- value=[item["image"] for item in gallery_data], # ギャラリーに表示する画像を指定
714
- label="参考音声選択画像",
715
- interactive=True,
716
- columns=3 # 3列で表示
717
- )
718
-
719
- # ギャラリー画像が選択されたときにMP3を自動で設定
720
- def update_reference_audio(selected_image):
721
- mp3_path = on_image_select(selected_image)
722
- return mp3_path
723
-
724
- # 参考音声を選択するためのインターフェースを更新
725
- gr.Interface(
726
- fn=voice_conversion,
727
- description=description,
728
- inputs=[*inputs, gallery], # ギャラリーを追加
729
- outputs=outputs,
730
- title="Seed Voice Conversion",
731
- examples=examples,
732
- cache_examples=False,
733
- ).launch()
734
-
735
 
736
  import gradio as gr
737
 
 
674
  ).export(format="mp3", bitrate=bitrate).read()
675
  yield mp3_bytes, None
676
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
 
678
  import gradio as gr
679