Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import torchaudio
|
|
7 |
import gradio as gr
|
8 |
import re
|
9 |
|
10 |
-
llasa_model_id = 'OmniAICreator/Llasa-1B
|
11 |
|
12 |
tokenizer = AutoTokenizer.from_pretrained(llasa_model_id)
|
13 |
|
@@ -112,7 +112,7 @@ def extract_speech_ids(speech_tokens_str):
|
|
112 |
return speech_ids
|
113 |
|
114 |
@spaces.GPU(duration=60)
|
115 |
-
def infer(sample_audio_path, target_text, temperature, top_p,
|
116 |
if not target_text or not target_text.strip():
|
117 |
gr.Warning("Please input text to generate audio.")
|
118 |
return None, None
|
@@ -183,7 +183,8 @@ def infer(sample_audio_path, target_text, temperature, top_p, progress=gr.Progr
|
|
183 |
eos_token_id=speech_end_id,
|
184 |
do_sample=True,
|
185 |
top_p=top_p,
|
186 |
-
temperature=temperature
|
|
|
187 |
)
|
188 |
|
189 |
# Extract the speech tokens
|
@@ -222,6 +223,7 @@ with gr.Blocks() as app_tts:
|
|
222 |
with gr.Row():
|
223 |
temperature_slider = gr.Slider(minimum=0.0, maximum=1.0, value=0.8, step=0.05, label="Temperature")
|
224 |
top_p_slider = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, step=0.05, label="Top-p")
|
|
|
225 |
|
226 |
generate_btn = gr.Button("Synthesize", variant="primary")
|
227 |
|
@@ -234,6 +236,7 @@ with gr.Blocks() as app_tts:
|
|
234 |
gen_text_input,
|
235 |
temperature_slider,
|
236 |
top_p_slider,
|
|
|
237 |
],
|
238 |
outputs=[audio_output],
|
239 |
)
|
|
|
7 |
import gradio as gr
|
8 |
import re
|
9 |
|
10 |
+
llasa_model_id = 'OmniAICreator/Galgame-Llasa-1B'
|
11 |
|
12 |
tokenizer = AutoTokenizer.from_pretrained(llasa_model_id)
|
13 |
|
|
|
112 |
return speech_ids
|
113 |
|
114 |
@spaces.GPU(duration=60)
|
115 |
+
def infer(sample_audio_path, target_text, temperature, top_p, repetition_penalty, progress=gr.Progress()):
|
116 |
if not target_text or not target_text.strip():
|
117 |
gr.Warning("Please input text to generate audio.")
|
118 |
return None, None
|
|
|
183 |
eos_token_id=speech_end_id,
|
184 |
do_sample=True,
|
185 |
top_p=top_p,
|
186 |
+
temperature=temperature,
|
187 |
+
repetition_penalty=repetition_penalty,
|
188 |
)
|
189 |
|
190 |
# Extract the speech tokens
|
|
|
223 |
with gr.Row():
|
224 |
temperature_slider = gr.Slider(minimum=0.0, maximum=1.0, value=0.8, step=0.05, label="Temperature")
|
225 |
top_p_slider = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, step=0.05, label="Top-p")
|
226 |
+
repetition_penalty_slider = gr.Slider(minimum=1.0, maximum=1.5, value=1.1, step=0.05, label="Repetition Penalty")
|
227 |
|
228 |
generate_btn = gr.Button("Synthesize", variant="primary")
|
229 |
|
|
|
236 |
gen_text_input,
|
237 |
temperature_slider,
|
238 |
top_p_slider,
|
239 |
+
repetition_penalty_slider,
|
240 |
],
|
241 |
outputs=[audio_output],
|
242 |
)
|