NeuralFalcon commited on
Commit
0076ef1
·
verified ·
1 Parent(s): f70d5f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -12,7 +12,8 @@ import shutil
12
  base_path=os.getcwd()
13
  def clean_folder_before_start():
14
  global base_path
15
- folder_list=["dummy","TTS_DUB","kokoro_audio"]
 
16
  for folder in folder_list:
17
  if os.path.exists(f"{base_path}/{folder}"):
18
  try:
@@ -131,7 +132,7 @@ def toggle_autoplay(autoplay):
131
  with gr.Blocks() as demo1:
132
  gr.Markdown("# Batched TTS")
133
  gr.Markdown("[Install on Windows/Linux](https://github.com/NeuralFalconYT/Kokoro-82M-WebUI)")
134
-
135
  with gr.Row():
136
  with gr.Column():
137
  text = gr.Textbox(
@@ -142,7 +143,7 @@ with gr.Blocks() as demo1:
142
  with gr.Row():
143
  voice = gr.Dropdown(
144
  voice_list,
145
- value='af',
146
  allow_custom_value=False,
147
  label='Voice',
148
  info='Starred voices are more stable'
@@ -200,7 +201,7 @@ def podcast_maker(text,remove_silence=False,minimum_silence=50,model_name="kokor
200
 
201
 
202
 
203
- dummpy_example="""{af} Hello, I'd like to order a sandwich please.
204
  {af_sky} What do you mean you're out of bread?
205
  {af_bella} I really wanted a sandwich though...
206
  {af_nicole} You know what, darn you and your little shop!
@@ -219,7 +220,7 @@ with gr.Blocks() as demo2:
219
  gr.Markdown(
220
  """
221
  **Example Input:**
222
- {af} Hello, I'd like to order a sandwich please.
223
  {af_sky} What do you mean you're out of bread?
224
  {af_bella} I really wanted a sandwich though...
225
  {af_nicole} You know what, darn you and your little shop!
@@ -325,6 +326,9 @@ def your_tts(text, audio_path, actual_duration, speed=1.0):
325
  shutil.copy(tts_path, audio_path)
326
 
327
 
 
 
 
328
  base_path="."
329
  import datetime
330
  def get_current_time():
@@ -584,7 +588,7 @@ class SRTDubbing:
584
  with open("entries.json", "w") as file:
585
  json.dump(entries, file, indent=4)
586
  return entries
587
- srt_voice_name="af"
588
  use_ffmpeg,local_ffmpeg_path = is_ffmpeg_installed()
589
  # use_ffmpeg=False
590
 
@@ -605,6 +609,8 @@ def srt_process(srt_file_path,voice_name,custom_voicepack=None,dest_language="en
605
  else:
606
  srt_voice_name=voice_name
607
  gr.Warning("Upload small size .pt file only. Using the Current voice pack instead.")
 
 
608
  srt_dubbing = SRTDubbing()
609
  dub_save_path=get_subtitle_Dub_path(srt_file_path,dest_language)
610
  srt_dubbing.srt_to_dub(srt_file_path,dub_save_path,dest_language)
@@ -634,7 +640,7 @@ with gr.Blocks() as demo3:
634
  with gr.Row():
635
  voice = gr.Dropdown(
636
  voice_list,
637
- value='af',
638
  allow_custom_value=False,
639
  label='Voice',
640
  )
@@ -924,17 +930,15 @@ def create_voice_mix_ui():
924
 
925
  demo4 = create_voice_mix_ui()
926
 
 
 
 
927
  # display_text = " \n".join(voice_list)
928
 
929
  # with gr.Blocks() as demo5:
930
- # gr.Markdown("[Install on Windows/Linux](https://github.com/NeuralFalconYT/Kokoro-82M-WebUI)")
931
  # gr.Markdown(f"# Voice Names \n{display_text}")
932
 
933
-
934
-
935
-
936
-
937
-
938
  import os
939
  import json
940
 
@@ -964,9 +968,6 @@ def get_voice_names():
964
  "other_voices": other_voices
965
  }, indent=4)
966
 
967
-
968
- # display_text = " \n".join(voice_list)
969
-
970
  with gr.Blocks() as demo5:
971
  gr.Markdown(f"# Voice Names")
972
  gr.Markdown("[Install on Windows/Linux](https://github.com/NeuralFalconYT/Kokoro-82M-WebUI)")
@@ -1017,4 +1018,4 @@ if __name__ == "__main__":
1017
 
1018
  # save_at=f"./temp_audio/{os.path.basename(result)}"
1019
  # shutil.move(result, save_at)
1020
- # print(f"Saved at {save_at}")
 
12
  base_path=os.getcwd()
13
  def clean_folder_before_start():
14
  global base_path
15
+ # folder_list=["dummy","TTS_DUB","kokoro_audio"]
16
+ folder_list=["dummy","TTS_DUB"]#,"kokoro_audio"]
17
  for folder in folder_list:
18
  if os.path.exists(f"{base_path}/{folder}"):
19
  try:
 
132
  with gr.Blocks() as demo1:
133
  gr.Markdown("# Batched TTS")
134
  gr.Markdown("[Install on Windows/Linux](https://github.com/NeuralFalconYT/Kokoro-82M-WebUI)")
135
+
136
  with gr.Row():
137
  with gr.Column():
138
  text = gr.Textbox(
 
143
  with gr.Row():
144
  voice = gr.Dropdown(
145
  voice_list,
146
+ value='af_bella',
147
  allow_custom_value=False,
148
  label='Voice',
149
  info='Starred voices are more stable'
 
201
 
202
 
203
 
204
+ dummpy_example="""{af_alloy} Hello, I'd like to order a sandwich please.
205
  {af_sky} What do you mean you're out of bread?
206
  {af_bella} I really wanted a sandwich though...
207
  {af_nicole} You know what, darn you and your little shop!
 
220
  gr.Markdown(
221
  """
222
  **Example Input:**
223
+ {af_alloy} Hello, I'd like to order a sandwich please.
224
  {af_sky} What do you mean you're out of bread?
225
  {af_bella} I really wanted a sandwich though...
226
  {af_nicole} You know what, darn you and your little shop!
 
326
  shutil.copy(tts_path, audio_path)
327
 
328
 
329
+
330
+
331
+
332
  base_path="."
333
  import datetime
334
  def get_current_time():
 
588
  with open("entries.json", "w") as file:
589
  json.dump(entries, file, indent=4)
590
  return entries
591
+ srt_voice_name="af_bella"
592
  use_ffmpeg,local_ffmpeg_path = is_ffmpeg_installed()
593
  # use_ffmpeg=False
594
 
 
609
  else:
610
  srt_voice_name=voice_name
611
  gr.Warning("Upload small size .pt file only. Using the Current voice pack instead.")
612
+ else:
613
+ srt_voice_name=voice_name
614
  srt_dubbing = SRTDubbing()
615
  dub_save_path=get_subtitle_Dub_path(srt_file_path,dest_language)
616
  srt_dubbing.srt_to_dub(srt_file_path,dub_save_path,dest_language)
 
640
  with gr.Row():
641
  voice = gr.Dropdown(
642
  voice_list,
643
+ value='af_bella',
644
  allow_custom_value=False,
645
  label='Voice',
646
  )
 
930
 
931
  demo4 = create_voice_mix_ui()
932
 
933
+
934
+
935
+
936
  # display_text = " \n".join(voice_list)
937
 
938
  # with gr.Blocks() as demo5:
 
939
  # gr.Markdown(f"# Voice Names \n{display_text}")
940
 
941
+ #get voice names useful for local api
 
 
 
 
942
  import os
943
  import json
944
 
 
968
  "other_voices": other_voices
969
  }, indent=4)
970
 
 
 
 
971
  with gr.Blocks() as demo5:
972
  gr.Markdown(f"# Voice Names")
973
  gr.Markdown("[Install on Windows/Linux](https://github.com/NeuralFalconYT/Kokoro-82M-WebUI)")
 
1018
 
1019
  # save_at=f"./temp_audio/{os.path.basename(result)}"
1020
  # shutil.move(result, save_at)
1021
+ # print(f"Saved at {save_at}")