Spaces:
Running
Running
Commit
·
9b8eb79
1
Parent(s):
cbdd616
Update main.py
Browse files
main.py
CHANGED
@@ -1,13 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
-
import
|
4 |
-
from tqdm import tqdm
|
5 |
-
import plotly.express as px
|
6 |
import pandas as pd
|
7 |
-
|
8 |
|
9 |
from svc_inference import main
|
10 |
-
from whisper.inference import check_and_download_model
|
11 |
|
12 |
# データの作成
|
13 |
data = {
|
@@ -30,7 +27,7 @@ df = pd.DataFrame(data)
|
|
30 |
|
31 |
def create_plot():
|
32 |
fig = px.scatter(df, x='x', y='y', text='id',
|
33 |
-
title='
|
34 |
|
35 |
# マーカーのスタイルを設定(紫系の色に設定)
|
36 |
fig.update_traces(
|
@@ -89,15 +86,22 @@ def run_main(audio_file, shift, speaker_id):
|
|
89 |
args.whisper_index_path = None
|
90 |
args.debug = False
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
try:
|
93 |
main(args)
|
94 |
-
|
|
|
95 |
except Exception as e:
|
96 |
return None
|
97 |
|
98 |
# Gradio インターフェースの作成
|
99 |
with gr.Blocks() as demo:
|
100 |
-
gr.Markdown("# SVC
|
101 |
|
102 |
with gr.Row():
|
103 |
with gr.Column(scale=1.15):
|
@@ -106,7 +110,7 @@ with gr.Blocks() as demo:
|
|
106 |
with gr.Column(scale=1):
|
107 |
# 入力音声のアップロード
|
108 |
input_audio = gr.Audio(
|
109 |
-
label="
|
110 |
type="filepath" # ファイルパスとして取得
|
111 |
)
|
112 |
# Speaker ID の選択
|
@@ -123,13 +127,13 @@ with gr.Blocks() as demo:
|
|
123 |
maximum=12,
|
124 |
value=0,
|
125 |
step=1,
|
126 |
-
label="Pitch Shift
|
127 |
)
|
128 |
# ボタン
|
129 |
-
run_btn = gr.Button(value="
|
130 |
|
131 |
# 出力表示用
|
132 |
-
output_audio = gr.Audio(label="
|
133 |
|
134 |
|
135 |
run_btn.click(
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
+
from datetime import datetime
|
|
|
|
|
4 |
import pandas as pd
|
5 |
+
import plotly.express as px
|
6 |
|
7 |
from svc_inference import main
|
|
|
8 |
|
9 |
# データの作成
|
10 |
data = {
|
|
|
27 |
|
28 |
def create_plot():
|
29 |
fig = px.scatter(df, x='x', y='y', text='id',
|
30 |
+
title='Interactive Numeric Scatter Plot')
|
31 |
|
32 |
# マーカーのスタイルを設定(紫系の色に設定)
|
33 |
fig.update_traces(
|
|
|
86 |
args.whisper_index_path = None
|
87 |
args.debug = False
|
88 |
|
89 |
+
# 現在時刻を取得してファイル名を生成
|
90 |
+
now = datetime.now()
|
91 |
+
date_str = now.strftime("%y%m%d")
|
92 |
+
time_str = now.strftime("%H%M%S")
|
93 |
+
output_filename = f"svc_id{speaker_str}_pitch{shift}_speed0_{date_str}_{time_str}.wav"
|
94 |
+
|
95 |
try:
|
96 |
main(args)
|
97 |
+
os.rename("svc_out.wav", output_filename) # ファイル名を変更
|
98 |
+
return output_filename # 新しいファイル名を返す
|
99 |
except Exception as e:
|
100 |
return None
|
101 |
|
102 |
# Gradio インターフェースの作成
|
103 |
with gr.Blocks() as demo:
|
104 |
+
gr.Markdown("# SVC 音声変換システム")
|
105 |
|
106 |
with gr.Row():
|
107 |
with gr.Column(scale=1.15):
|
|
|
110 |
with gr.Column(scale=1):
|
111 |
# 入力音声のアップロード
|
112 |
input_audio = gr.Audio(
|
113 |
+
label="変換したい音声をアップロード",
|
114 |
type="filepath" # ファイルパスとして取得
|
115 |
)
|
116 |
# Speaker ID の選択
|
|
|
127 |
maximum=12,
|
128 |
value=0,
|
129 |
step=1,
|
130 |
+
label="Pitch Shift(-12から+12の半音)"
|
131 |
)
|
132 |
# ボタン
|
133 |
+
run_btn = gr.Button(value="音声変換を実行", variant="primary", size="lg")
|
134 |
|
135 |
# 出力表示用
|
136 |
+
output_audio = gr.Audio(label="変換後の音声")
|
137 |
|
138 |
|
139 |
run_btn.click(
|