atsushieee commited on
Commit
414f5e3
·
1 Parent(s): ed37553

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +15 -5
main.py CHANGED
@@ -63,7 +63,7 @@ def create_plot():
63
 
64
  return fig
65
 
66
- def run_main(audio_file,shift):
67
  # 固定の引数を設定
68
  class Args:
69
  pass
@@ -71,7 +71,8 @@ def run_main(audio_file,shift):
71
  args = Args()
72
  args.config = "configs/base.yaml"
73
  args.model = "./vits_pretrain/sovits5.0.pretrain.pth"
74
- args.spk = "./configs/singers/singer0001.npy"
 
75
  args.wave = audio_file
76
  args.shift = shift
77
 
@@ -103,7 +104,16 @@ with gr.Blocks() as demo:
103
  type="filepath" # ファイルパスとして取得
104
  )
105
 
106
- plot = gr.Plot(value=create_plot())
 
 
 
 
 
 
 
 
 
107
 
108
  # Pitch シフトのスライダー
109
  shift = gr.Slider(
@@ -123,10 +133,10 @@ with gr.Blocks() as demo:
123
 
124
  run_btn.click(
125
  fn=run_main,
126
- inputs=[input_audio, shift],
127
  outputs=[output_audio]
128
  )
129
 
130
  # アプリケーションの起動
131
  if __name__ == "__main__":
132
- demo.launch()
 
63
 
64
  return fig
65
 
66
+ def run_main(audio_file,shift, speaker_id):
67
  # 固定の引数を設定
68
  class Args:
69
  pass
 
71
  args = Args()
72
  args.config = "configs/base.yaml"
73
  args.model = "./vits_pretrain/sovits5.0.pretrain.pth"
74
+ speaker_str = f"{speaker_id:04d}"
75
+ args.spk = f"./configs/singers/singer{speaker_str}.npy"
76
  args.wave = audio_file
77
  args.shift = shift
78
 
 
104
  type="filepath" # ファイルパスとして取得
105
  )
106
 
107
+ with gr.Row():
108
+ plot = gr.Plot(value=create_plot())
109
+ # Speaker ID の選択
110
+ speaker_id = gr.Number(
111
+ label="Speaker ID (1-56)",
112
+ value=1,
113
+ minimum=1,
114
+ maximum=56,
115
+ step=1
116
+ )
117
 
118
  # Pitch シフトのスライダー
119
  shift = gr.Slider(
 
133
 
134
  run_btn.click(
135
  fn=run_main,
136
+ inputs=[input_audio, shift, speaker_id],
137
  outputs=[output_audio]
138
  )
139
 
140
  # アプリケーションの起動
141
  if __name__ == "__main__":
142
+ demo.launch()