Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -344,16 +344,20 @@ reference_files = [
|
|
344 |
]
|
345 |
|
346 |
gallery_items = [[os.path.join(default_dir, f"{filename}.webp"), name] for name, filename in reference_files]
|
347 |
-
|
348 |
default_reference = os.path.join(default_dir, f"{reference_files[0][1]}.mp3")
|
349 |
|
350 |
description = ("Zero-shot音声変換モデル(学習不要)。ローカルでの利用方法は[GitHubリポジトリ](https://github.com/Plachtaa/seed-vc)をご覧ください。"
|
351 |
"参考音声が25秒を超える場合、自動的に25秒にクリップされます。"
|
352 |
"また、元音声と参考音声の合計時間が30秒を超える場合、元音声は分割処理されます。")
|
353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
inputs = [
|
355 |
gr.Audio(type="filepath", label="元音声"),
|
356 |
-
gr.Audio(type="filepath", label="参考音声", visible=False, value=default_reference),
|
357 |
gr.Gallery(label="参照音声を選択", value=gallery_items, columns=5, interactive=True),
|
358 |
gr.Slider(minimum=1, maximum=200, value=10, step=1, label="拡散ステップ数", info="デフォルトは10、50~100が最適な品質"),
|
359 |
gr.Slider(minimum=0.5, maximum=2.0, step=0.1, value=1.0, label="長さ調整", info="1.0未満で速度を上げ、1.0以上で速度を遅くします"),
|
@@ -369,10 +373,10 @@ outputs = [
|
|
369 |
]
|
370 |
|
371 |
gr.Interface(
|
372 |
-
fn=
|
373 |
description=description,
|
374 |
inputs=inputs,
|
375 |
outputs=outputs,
|
376 |
title="Seed Voice Conversion with Reference Gallery",
|
377 |
cache_examples=False,
|
378 |
-
).launch()
|
|
|
344 |
]
|
345 |
|
346 |
gallery_items = [[os.path.join(default_dir, f"{filename}.webp"), name] for name, filename in reference_files]
|
|
|
347 |
default_reference = os.path.join(default_dir, f"{reference_files[0][1]}.mp3")
|
348 |
|
349 |
description = ("Zero-shot音声変換モデル(学習不要)。ローカルでの利用方法は[GitHubリポジトリ](https://github.com/Plachtaa/seed-vc)をご覧ください。"
|
350 |
"参考音声が25秒を超える場合、自動的に25秒にクリップされます。"
|
351 |
"また、元音声と参考音声の合計時間が30秒を超える場合、元音声は分割処理されます。")
|
352 |
|
353 |
+
# 参照音声をギャラリーで選択し、その音声ファイルをセットするプロキシ関数
|
354 |
+
def proxy_voice_conversion(source, selected_gallery_item, diffusion_steps, length_adjust, inference_cfg_rate, f0_condition, auto_f0_adjust, pitch_shift):
|
355 |
+
# ギャラリーで選択された画像に対応する音声ファイルを取得
|
356 |
+
reference_file = os.path.join(default_dir, f"{selected_gallery_item}.mp3")
|
357 |
+
return voice_conversion(source, reference_file, diffusion_steps, length_adjust, inference_cfg_rate, f0_condition, auto_f0_adjust, pitch_shift)
|
358 |
+
|
359 |
inputs = [
|
360 |
gr.Audio(type="filepath", label="元音声"),
|
|
|
361 |
gr.Gallery(label="参照音声を選択", value=gallery_items, columns=5, interactive=True),
|
362 |
gr.Slider(minimum=1, maximum=200, value=10, step=1, label="拡散ステップ数", info="デフォルトは10、50~100が最適な品質"),
|
363 |
gr.Slider(minimum=0.5, maximum=2.0, step=0.1, value=1.0, label="長さ調整", info="1.0未満で速度を上げ、1.0以上で速度を遅くします"),
|
|
|
373 |
]
|
374 |
|
375 |
gr.Interface(
|
376 |
+
fn=proxy_voice_conversion,
|
377 |
description=description,
|
378 |
inputs=inputs,
|
379 |
outputs=outputs,
|
380 |
title="Seed Voice Conversion with Reference Gallery",
|
381 |
cache_examples=False,
|
382 |
+
).launch()
|