Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import random
|
|
6 |
import torch
|
7 |
|
8 |
IS_DUPLICATE = not os.getenv('SPACE_ID', '').startswith('hexgrad/')
|
9 |
-
CHAR_LIMIT = None
|
10 |
|
11 |
CUDA_AVAILABLE = torch.cuda.is_available()
|
12 |
models = {gpu: KModel().to('cuda' if gpu else 'cpu').eval() for gpu in [False] + ([True] if CUDA_AVAILABLE else [])}
|
@@ -164,8 +164,8 @@ with gr.Blocks() as generate_tab:
|
|
164 |
|
165 |
BANNER_TEXT = '''
|
166 |
[***Kokoro*** **is an open-weight TTS model with 82 million parameters.**](https://huggingface.co/hexgrad/Kokoro-82M)
|
167 |
-
|
168 |
-
|
169 |
'''
|
170 |
|
171 |
API_OPEN = os.getenv('SPACE_ID') != 'hexgrad/Kokoro-TTS'
|
@@ -190,7 +190,7 @@ with gr.Blocks() as app:
|
|
190 |
with gr.Column():
|
191 |
gr.TabbedInterface([generate_tab], ['Generate'])
|
192 |
random_btn.click(fn=get_random_text, inputs=[voice], outputs=[text], api_name=API_NAME)
|
193 |
-
generate_btn.click(fn=
|
194 |
tokenize_btn.click(fn=tokenize_first, inputs=[text, voice], outputs=[out_ps], api_name=API_NAME)
|
195 |
predict_btn.click(fn=predict, inputs=[text, voice, speed], outputs=[out_audio], api_name=API_NAME)
|
196 |
|
|
|
6 |
import torch
|
7 |
|
8 |
IS_DUPLICATE = not os.getenv('SPACE_ID', '').startswith('hexgrad/')
|
9 |
+
CHAR_LIMIT = None
|
10 |
|
11 |
CUDA_AVAILABLE = torch.cuda.is_available()
|
12 |
models = {gpu: KModel().to('cuda' if gpu else 'cpu').eval() for gpu in [False] + ([True] if CUDA_AVAILABLE else [])}
|
|
|
164 |
|
165 |
BANNER_TEXT = '''
|
166 |
[***Kokoro*** **is an open-weight TTS model with 82 million parameters.**](https://huggingface.co/hexgrad/Kokoro-82M)
|
167 |
+
As of January 31st, 2025, Kokoro was the most-liked [**TTS model**](https://huggingface.co/models?pipeline_tag=text-to-speech&sort=likes) and the most-liked [**TTS space**](https://huggingface.co/spaces?sort=likes&search=tts) on Hugging Face.
|
168 |
+
This demo only showcases English, but you can directly use the model to access other languages.
|
169 |
'''
|
170 |
|
171 |
API_OPEN = os.getenv('SPACE_ID') != 'hexgrad/Kokoro-TTS'
|
|
|
190 |
with gr.Column():
|
191 |
gr.TabbedInterface([generate_tab], ['Generate'])
|
192 |
random_btn.click(fn=get_random_text, inputs=[voice], outputs=[text], api_name=API_NAME)
|
193 |
+
generate_btn.click(fn=generate_first, inputs=[text, voice, speed, use_gpu], outputs=[out_audio, out_ps], api_name=API_NAME)
|
194 |
tokenize_btn.click(fn=tokenize_first, inputs=[text, voice], outputs=[out_ps], api_name=API_NAME)
|
195 |
predict_btn.click(fn=predict, inputs=[text, voice, speed], outputs=[out_audio], api_name=API_NAME)
|
196 |
|