NoCrypt commited on
Commit
3971395
1 Parent(s): c552384

add banner

Browse files
Files changed (2) hide show
  1. app.py +15 -9
  2. imgs/banner_mikutts.webp +0 -0
app.py CHANGED
@@ -39,8 +39,10 @@ tts_voice_list = asyncio.get_event_loop().run_until_complete(edge_tts.list_voice
39
  tts_voices = [f"{v['ShortName']}-{v['Gender']}" for v in tts_voice_list]
40
 
41
  # RVC models
42
- model_root = snapshot_download(repo_id="NoCrypt/miku_RVC", token=os.environ["TOKEN"])
43
- models = [d for d in os.listdir(model_root) if os.path.isdir(f"{model_root}/{d}")]
 
 
44
  models.sort()
45
 
46
 
@@ -59,12 +61,14 @@ def model_data(model_name):
59
  version = cpt.get("version", "v1")
60
  if version == "v1":
61
  if if_f0 == 1:
62
- net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=config.is_half)
 
63
  else:
64
  net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
65
  elif version == "v2":
66
  if if_f0 == 1:
67
- net_g = SynthesizerTrnMs768NSFsid(*cpt["config"], is_half=config.is_half)
 
68
  else:
69
  net_g = SynthesizerTrnMs768NSFsid_nono(*cpt["config"])
70
  else:
@@ -129,7 +133,8 @@ def tts(
129
  print(tts_text)
130
  print(f"tts_voice: {tts_voice}, speed: {speed}")
131
  print(f"Model name: {model_name}")
132
- print(f"F0: {f0_method}, Key: {f0_up_key}, Index: {index_rate}, Protect: {protect}")
 
133
  try:
134
  t0 = time.time()
135
  if speed >= 0:
@@ -205,7 +210,7 @@ rmvpe_model = RMVPE("rmvpe.pt", config.is_half, config.device)
205
  print("rmvpe model loaded.")
206
 
207
  initial_md = """
208
- # Miku TTS
209
  """
210
 
211
  app = gr.Blocks()
@@ -214,13 +219,13 @@ with app:
214
  with gr.Row():
215
  with gr.Column():
216
  model_name = gr.Dropdown(
217
- label="Model (all models except man-_ are girl models)",
218
  choices=models,
219
  value=models[0],
220
  )
221
  f0_key_up = gr.Number(
222
  label="Tune (+12 = 1 octave up from edge-tts, the best value depends on the models and speakers)",
223
- value=2,
224
  )
225
  with gr.Column():
226
  f0_method = gr.Radio(
@@ -260,7 +265,8 @@ with app:
260
  step=10,
261
  interactive=True,
262
  )
263
- tts_text = gr.Textbox(label="Input Text", value="これは日本語テキストから音声への変換デモです。")
 
264
  with gr.Column():
265
  but0 = gr.Button("Convert", variant="primary")
266
  info_text = gr.Textbox(label="Output info")
 
39
  tts_voices = [f"{v['ShortName']}-{v['Gender']}" for v in tts_voice_list]
40
 
41
  # RVC models
42
+ model_root = snapshot_download(
43
+ repo_id="NoCrypt/miku_RVC", token=os.environ["TOKEN"])
44
+ models = [d for d in os.listdir(
45
+ model_root) if os.path.isdir(f"{model_root}/{d}")]
46
  models.sort()
47
 
48
 
 
61
  version = cpt.get("version", "v1")
62
  if version == "v1":
63
  if if_f0 == 1:
64
+ net_g = SynthesizerTrnMs256NSFsid(
65
+ *cpt["config"], is_half=config.is_half)
66
  else:
67
  net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
68
  elif version == "v2":
69
  if if_f0 == 1:
70
+ net_g = SynthesizerTrnMs768NSFsid(
71
+ *cpt["config"], is_half=config.is_half)
72
  else:
73
  net_g = SynthesizerTrnMs768NSFsid_nono(*cpt["config"])
74
  else:
 
133
  print(tts_text)
134
  print(f"tts_voice: {tts_voice}, speed: {speed}")
135
  print(f"Model name: {model_name}")
136
+ print(
137
+ f"F0: {f0_method}, Key: {f0_up_key}, Index: {index_rate}, Protect: {protect}")
138
  try:
139
  t0 = time.time()
140
  if speed >= 0:
 
210
  print("rmvpe model loaded.")
211
 
212
  initial_md = """
213
+ ![banner that says mikutts](https://huggingface.co/spaces/NoCrypt/mikuTTS/resolve/main/imgs/banner_mikutts.webp)
214
  """
215
 
216
  app = gr.Blocks()
 
219
  with gr.Row():
220
  with gr.Column():
221
  model_name = gr.Dropdown(
222
+ label="Model",
223
  choices=models,
224
  value=models[0],
225
  )
226
  f0_key_up = gr.Number(
227
  label="Tune (+12 = 1 octave up from edge-tts, the best value depends on the models and speakers)",
228
+ value=6,
229
  )
230
  with gr.Column():
231
  f0_method = gr.Radio(
 
265
  step=10,
266
  interactive=True,
267
  )
268
+ tts_text = gr.Textbox(label="Input Text",
269
+ value="こんにちは、私の名前は初音ミクです!")
270
  with gr.Column():
271
  but0 = gr.Button("Convert", variant="primary")
272
  info_text = gr.Textbox(label="Output info")
imgs/banner_mikutts.webp ADDED