Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -906,19 +906,58 @@ def create_voice_mix_ui():
|
|
| 906 |
|
| 907 |
demo4 = create_voice_mix_ui()
|
| 908 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 913 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 914 |
|
| 915 |
|
| 916 |
-
display_text = " \n".join(voice_list)
|
| 917 |
|
| 918 |
with gr.Blocks() as demo5:
|
|
|
|
| 919 |
gr.Markdown("[Install on Windows/Linux](https://github.com/NeuralFalconYT/Kokoro-82M-WebUI)")
|
| 920 |
-
gr.
|
| 921 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 922 |
|
| 923 |
|
| 924 |
|
|
|
|
| 906 |
|
| 907 |
demo4 = create_voice_mix_ui()
|
| 908 |
|
| 909 |
+
# display_text = " \n".join(voice_list)
|
| 910 |
+
|
| 911 |
+
# with gr.Blocks() as demo5:
|
| 912 |
+
# gr.Markdown("[Install on Windows/Linux](https://github.com/NeuralFalconYT/Kokoro-82M-WebUI)")
|
| 913 |
+
# gr.Markdown(f"# Voice Names \n{display_text}")
|
| 914 |
+
|
| 915 |
+
|
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
+
import os
|
| 921 |
+
import json
|
| 922 |
+
|
| 923 |
+
def get_voice_names():
|
| 924 |
+
male_voices, female_voices, other_voices = [], [], []
|
| 925 |
+
|
| 926 |
+
for filename in os.listdir("./KOKORO/voices"):
|
| 927 |
+
if filename.endswith('.pt'):
|
| 928 |
+
name = os.path.splitext(filename)[0]
|
| 929 |
+
if "m_" in name:
|
| 930 |
+
male_voices.append(name)
|
| 931 |
+
elif name=="af":
|
| 932 |
+
female_voices.append(name)
|
| 933 |
+
elif "f_" in name:
|
| 934 |
+
female_voices.append(name)
|
| 935 |
+
else:
|
| 936 |
+
other_voices.append(name)
|
| 937 |
+
|
| 938 |
+
# Sort the lists by the length of the voice names
|
| 939 |
+
male_voices = sorted(male_voices, key=len)
|
| 940 |
+
female_voices = sorted(female_voices, key=len)
|
| 941 |
+
other_voices = sorted(other_voices, key=len)
|
| 942 |
|
| 943 |
+
return json.dumps({
|
| 944 |
+
"male_voices": male_voices,
|
| 945 |
+
"female_voices": female_voices,
|
| 946 |
+
"other_voices": other_voices
|
| 947 |
+
}, indent=4)
|
| 948 |
|
| 949 |
|
| 950 |
+
# display_text = " \n".join(voice_list)
|
| 951 |
|
| 952 |
with gr.Blocks() as demo5:
|
| 953 |
+
gr.Markdown(f"# Voice Names")
|
| 954 |
gr.Markdown("[Install on Windows/Linux](https://github.com/NeuralFalconYT/Kokoro-82M-WebUI)")
|
| 955 |
+
get_voice_button = gr.Button("Get Voice Names")
|
| 956 |
+
voice_names = gr.Textbox(label="Voice Names", placeholder="Click 'Get Voice Names' to display the list of available voice names", lines=10)
|
| 957 |
+
get_voice_button.click(get_voice_names, outputs=[voice_names])
|
| 958 |
+
|
| 959 |
+
|
| 960 |
+
|
| 961 |
|
| 962 |
|
| 963 |
|