Mahiruoshi commited on
Commit
4cc1ba6
1 Parent(s): 2674c8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -22,17 +22,18 @@ class VitsGradio:
22
  def __init__(self):
23
  self.dev = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
24
  self.lan = ["中文","日文","自动","手动"]
25
- self.idols = ["高咲侑","歩夢","かすみ","しずく","果林","愛","彼方","せつ菜","璃奈","栞子","エマ","ランジュ","ミア","華恋","まひる","なな","クロディーヌ","ひかり",'純那',"香子","真矢","双葉","ミチル","メイファン","やちよ","晶","いちえ","ゆゆ子","塁","珠緒","あるる","ララフィン","美空","静羽","あるる"]
26
  self.modelPaths = []
27
- self.loadCk('tmp')
28
  for root,dirs,files in os.walk("checkpoints"):
29
  for dir in dirs:
30
  self.modelPaths.append(dir)
31
  with gr.Blocks() as self.Vits:
32
  gr.Markdown(
33
- "## <center> Lovelive虹团-少女歌剧VITS\n"
34
  "### <center> 请不要生成会对个人以及企划造成侵害的内容\n"
35
- "<div align='center'>由于神秘bug,无法切换模型,轻量化版本 https://huggingface.co/spaces/Mahiruoshi/lovelive-ShojoKageki-vits </div>")
 
 
36
  with gr.Tab("TTS合成"):
37
  with gr.Row():
38
  with gr.Column():
@@ -43,11 +44,17 @@ class VitsGradio:
43
  input3 = gr.Dropdown(label="Speaker", choices=self.idols, value="歩夢", interactive=True)
44
  btnVC = gr.Button("Submit")
45
  with gr.Column():
46
- input4 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声比例(noise scale),以控制情感", value=0.6)
47
- input5 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声偏差(noise scale w),以控制音素长短", value=0.668)
48
  input6 = gr.Slider(minimum=0.1, maximum=10, label="duration", value=1)
49
  output1 = gr.Audio(label="采样率22050")
50
  btnVC.click(self.infer, inputs=[input1, input2, input3, input4, input5, input6], outputs=[output1])
 
 
 
 
 
 
51
  with gr.Tab("Voice Conversion"):
52
  gr.Markdown("""
53
  录制或上传声音,并选择要转换的音色。
@@ -73,8 +80,8 @@ class VitsGradio:
73
  input3 = gr.Dropdown(label="Speaker", choices=self.idols, value="歩夢", interactive=True)
74
  btnVC = gr.Button("Submit")
75
  with gr.Column():
76
- input4 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声比例(noise scale),以控制情感", value=0.6)
77
- input5 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声偏差(noise scale w),以控制音素长短", value=0.668)
78
  input6 = gr.Slider(minimum=0.1, maximum=10, label="Duration", value=1)
79
  output1 = gr.Audio(label="采样率22050")
80
  subtitle = gr.outputs.File(label="字幕文件:subtitles.srt")
 
22
  def __init__(self):
23
  self.dev = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
24
  self.lan = ["中文","日文","自动","手动"]
25
+ self.idols = ["c1","c2","高咲侑","歩夢","かすみ","しずく","果林","愛","彼方","せつ菜","璃奈","栞子","エマ","ランジュ","ミア","華恋","まひる","なな","クロディーヌ","ひかり",'純那',"香子","真矢","双葉","ミチル","メイファン","やちよ","晶","いちえ","ゆゆ子","塁","珠緒","あるる","ララフィン","美空","静羽","あるる"]
26
  self.modelPaths = []
 
27
  for root,dirs,files in os.walk("checkpoints"):
28
  for dir in dirs:
29
  self.modelPaths.append(dir)
30
  with gr.Blocks() as self.Vits:
31
  gr.Markdown(
32
+ "## <center> Lovelive虹团中日双语VITS\n"
33
  "### <center> 请不要生成会对个人以及企划造成侵害的内容\n"
34
+ "<div align='center'>目前有标贝普通话版,去标贝版,少歌模型还是大饼状态</div>"
35
+ '<div align="center"><a>参数说明:由于爱抖露们过于有感情,合成日语时建议将噪声比例调节至0.2-0.3区间,噪声偏差对应着每个字之间的间隔,对普通话影响较大,duration代表整体语速</div>'
36
+ '<div align="center"><a>合成前请先选择模型,否则第一次合成不一定成功。长段落/小说合成建议colab或本地运行</div>')
37
  with gr.Tab("TTS合成"):
38
  with gr.Row():
39
  with gr.Column():
 
44
  input3 = gr.Dropdown(label="Speaker", choices=self.idols, value="歩夢", interactive=True)
45
  btnVC = gr.Button("Submit")
46
  with gr.Column():
47
+ input4 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声比例(noise scale),以控制情感", value=0.267)
48
+ input5 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声偏差(noise scale w),以控制音素长短", value=0.7)
49
  input6 = gr.Slider(minimum=0.1, maximum=10, label="duration", value=1)
50
  output1 = gr.Audio(label="采样率22050")
51
  btnVC.click(self.infer, inputs=[input1, input2, input3, input4, input5, input6], outputs=[output1])
52
+ with gr.Tab("选择模型"):
53
+ with gr.Column():
54
+ modelstrs = gr.Dropdown(label = "模型", choices = self.modelPaths, value = self.modelPaths[0], type = "value")
55
+ btnMod = gr.Button("载入模型")
56
+ statusa = gr.TextArea()
57
+ btnMod.click(self.loadCk, inputs=[modelstrs], outputs = [statusa])
58
  with gr.Tab("Voice Conversion"):
59
  gr.Markdown("""
60
  录制或上传声音,并选择要转换的音色。
 
80
  input3 = gr.Dropdown(label="Speaker", choices=self.idols, value="歩夢", interactive=True)
81
  btnVC = gr.Button("Submit")
82
  with gr.Column():
83
+ input4 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声比例(noise scale),以控制情感", value=0.267)
84
+ input5 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声偏差(noise scale w),以控制音素长短", value=0.7)
85
  input6 = gr.Slider(minimum=0.1, maximum=10, label="Duration", value=1)
86
  output1 = gr.Audio(label="采样率22050")
87
  subtitle = gr.outputs.File(label="字幕文件:subtitles.srt")