Spaces:
Running
Running
Commit
·
ed37553
1
Parent(s):
a6bec57
Update main.py
Browse files
main.py
CHANGED
@@ -2,10 +2,66 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import requests
|
4 |
from tqdm import tqdm
|
|
|
|
|
|
|
5 |
|
6 |
from svc_inference import main
|
7 |
from whisper.inference import check_and_download_model
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
def run_main(audio_file,shift):
|
11 |
# 固定の引数を設定
|
@@ -46,6 +102,8 @@ with gr.Blocks() as demo:
|
|
46 |
label="変換したい音声をアップロード",
|
47 |
type="filepath" # ファイルパスとして取得
|
48 |
)
|
|
|
|
|
49 |
|
50 |
# Pitch シフトのスライダー
|
51 |
shift = gr.Slider(
|
|
|
2 |
import os
|
3 |
import requests
|
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 = {
|
14 |
+
'id': list(range(1, 57)), # 1から56までの数字
|
15 |
+
'x': [
|
16 |
+
28, 25, 5, 12, 8, 2, 0, -20, -15, -12, -20, 8, -30, 25, 0, 0, 2, -25,
|
17 |
+
-25, 20, 15, -2, 0, 15, -30, 15, 8, 28, -10, -22, 20, 20, 8, 20, 0,
|
18 |
+
0, -8, -10, -32, 0, 0, -8, 2, -25, -32, -20, -18, -5, 15, -22, -25,
|
19 |
+
-28, -30, 10, 25, 28
|
20 |
+
],
|
21 |
+
'y': [
|
22 |
+
0, -5, -15, -20, -18, -3, 8, 8, 12, 10, 10, -20, 6, -3, 12, -15, 12,
|
23 |
+
17, 10, -8, -15, -22, 8, 15, 10, -15, -18, -10, 8, 5, -10, -8, -25,
|
24 |
+
-5, -12, 12, 15, 6, 17, -12, -8, -8, 15, 17, 25, 4, 4, 0, 0, -20,
|
25 |
+
12, 12, 15, -19, 0, 0
|
26 |
+
]
|
27 |
+
}
|
28 |
+
|
29 |
+
df = pd.DataFrame(data)
|
30 |
+
|
31 |
+
def create_plot():
|
32 |
+
fig = px.scatter(df, x='x', y='y', text='id',
|
33 |
+
title='Interactive Numeric Scatter Plot')
|
34 |
+
|
35 |
+
# マーカーのスタイルを設定(紫系の色に設定)
|
36 |
+
fig.update_traces(
|
37 |
+
marker=dict(
|
38 |
+
size=10,
|
39 |
+
color='#663399', # 紫色
|
40 |
+
line=dict(color='#4B0082', width=1) # より暗い紫の境界線
|
41 |
+
),
|
42 |
+
textposition='top center'
|
43 |
+
)
|
44 |
+
|
45 |
+
# レイアウトの設定
|
46 |
+
fig.update_layout(
|
47 |
+
height=600,
|
48 |
+
width=800,
|
49 |
+
clickmode='event+select',
|
50 |
+
plot_bgcolor='white',
|
51 |
+
paper_bgcolor='white',
|
52 |
+
xaxis=dict(
|
53 |
+
showgrid=False,
|
54 |
+
zeroline=False,
|
55 |
+
range=[-35, 35] # x軸の範囲を設定
|
56 |
+
),
|
57 |
+
yaxis=dict(
|
58 |
+
showgrid=False,
|
59 |
+
zeroline=False,
|
60 |
+
range=[-30, 30] # y軸の範囲を設定
|
61 |
+
)
|
62 |
+
)
|
63 |
+
|
64 |
+
return fig
|
65 |
|
66 |
def run_main(audio_file,shift):
|
67 |
# 固定の引数を設定
|
|
|
102 |
label="変換したい音声をアップロード",
|
103 |
type="filepath" # ファイルパスとして取得
|
104 |
)
|
105 |
+
|
106 |
+
plot = gr.Plot(value=create_plot())
|
107 |
|
108 |
# Pitch シフトのスライダー
|
109 |
shift = gr.Slider(
|