Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -241,19 +241,15 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue="blue", secondary_hue="sky"), ti
|
|
| 241 |
text_input = gr.Textbox(label="Input Text", placeholder="Enter text to convert to Animalese")
|
| 242 |
shorten_input = gr.Checkbox(label="Shorten Words")
|
| 243 |
pitch_input = gr.Slider(minimum=0.2, maximum=2.0, step=0.1, value=1.0, label="Pitch", visible=False)
|
| 244 |
-
|
| 245 |
sound_gui = gr.Audio(value=None,type="filepath",autoplay=False,visible=True)
|
| 246 |
-
|
| 247 |
-
inputs=[text_input, shorten_input, pitch_input],
|
| 248 |
-
outputs=sound_gui)
|
| 249 |
def update():
|
| 250 |
print(MODELS)
|
| 251 |
return gr.Dropdown(label="Model",choices=[model["model_name"] for model in MODELS],visible=True,interactive=True, value=MODELS[0]["model_name"],)
|
| 252 |
with gr.Row():
|
| 253 |
models_dropdown = gr.Dropdown(label="Model",choices=[model["model_name"] for model in MODELS],visible=True,interactive=True, value=MODELS[0]["model_name"],)
|
| 254 |
-
|
| 255 |
-
refresh_button.click(update, outputs=[models_dropdown])
|
| 256 |
-
|
| 257 |
pitch_lvl_conf = gr.Slider(label="Pitch level (lower -> 'male' while higher -> 'female')",minimum=-12,maximum=12,step=1,value=0,visible=True,interactive=True,)
|
| 258 |
|
| 259 |
with gr.Accordion("Settings", open=False, visible=False):
|
|
@@ -262,10 +258,18 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue="blue", secondary_hue="sky"), ti
|
|
| 262 |
respiration_filter_conf = gr.Slider(minimum=0,maximum=7,label="Respiration median filtering",value=3,step=1,interactive=True,)
|
| 263 |
envelope_ratio_conf = gr.Slider(minimum=0,maximum=1,label="Envelope ratio",value=0.25,interactive=True,)
|
| 264 |
consonant_protec_conf = gr.Slider(minimum=0,maximum=0.5,label="Consonant breath protection",value=0.5,interactive=True,)
|
| 265 |
-
|
| 266 |
-
|
|
|
|
|
|
|
| 267 |
output_conf = gr.Audio(type="filepath",label="Output",)
|
| 268 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
button_conf.click(lambda :None, None, output_conf)
|
| 270 |
button_conf.click(
|
| 271 |
run,
|
|
|
|
| 241 |
text_input = gr.Textbox(label="Input Text", placeholder="Enter text to convert to Animalese")
|
| 242 |
shorten_input = gr.Checkbox(label="Shorten Words")
|
| 243 |
pitch_input = gr.Slider(minimum=0.2, maximum=2.0, step=0.1, value=1.0, label="Pitch", visible=False)
|
| 244 |
+
|
| 245 |
sound_gui = gr.Audio(value=None,type="filepath",autoplay=False,visible=True)
|
| 246 |
+
|
|
|
|
|
|
|
| 247 |
def update():
|
| 248 |
print(MODELS)
|
| 249 |
return gr.Dropdown(label="Model",choices=[model["model_name"] for model in MODELS],visible=True,interactive=True, value=MODELS[0]["model_name"],)
|
| 250 |
with gr.Row():
|
| 251 |
models_dropdown = gr.Dropdown(label="Model",choices=[model["model_name"] for model in MODELS],visible=True,interactive=True, value=MODELS[0]["model_name"],)
|
| 252 |
+
|
|
|
|
|
|
|
| 253 |
pitch_lvl_conf = gr.Slider(label="Pitch level (lower -> 'male' while higher -> 'female')",minimum=-12,maximum=12,step=1,value=0,visible=True,interactive=True,)
|
| 254 |
|
| 255 |
with gr.Accordion("Settings", open=False, visible=False):
|
|
|
|
| 258 |
respiration_filter_conf = gr.Slider(minimum=0,maximum=7,label="Respiration median filtering",value=3,step=1,interactive=True,)
|
| 259 |
envelope_ratio_conf = gr.Slider(minimum=0,maximum=1,label="Envelope ratio",value=0.25,interactive=True,)
|
| 260 |
consonant_protec_conf = gr.Slider(minimum=0,maximum=0.5,label="Consonant breath protection",value=0.5,interactive=True,)
|
| 261 |
+
with gr.Group():
|
| 262 |
+
refresh_button = gr.Button("Refresh Models")
|
| 263 |
+
preview_button = gr.Button("Preview!")
|
| 264 |
+
button_conf = gr.Button("Convert",variant="primary",)
|
| 265 |
output_conf = gr.Audio(type="filepath",label="Output",)
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
refresh_button.click(update, outputs=[models_dropdown])
|
| 269 |
+
|
| 270 |
+
preview_button.click(fn=lambda text, shorten, pitch: preview_audio(generate_audio(text, shorten, pitch)),
|
| 271 |
+
inputs=[text_input, shorten_input, pitch_input],
|
| 272 |
+
outputs=sound_gui)
|
| 273 |
button_conf.click(lambda :None, None, output_conf)
|
| 274 |
button_conf.click(
|
| 275 |
run,
|