Fabrice-TIERCELIN commited on
Commit
57093c2
1 Parent(s): abd262a

Format choice

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -92,10 +92,11 @@ def check(
92
  if not output_number in [1, 2, 3]:
93
  raise gr.Error("Please ask for 1, 2 or 3 output files.")
94
 
95
- def update_output(output_number):
96
  return [
97
- gr.update(visible = (2 <= output_number)),
98
- gr.update(visible = (output_number == 3))
 
99
  ]
100
 
101
  def text2audio(
@@ -147,6 +148,7 @@ with gr.Blocks() as interface:
147
  )
148
  input_text = gr.Textbox(label = "Prompt", value = "Snort of a horse", lines = 2, autofocus = True)
149
  with gr.Accordion("Advanced options", open = False):
 
150
  output_number = gr.Slider(label = "Number of generations", info = "1, 2 or 3 output files", minimum = 1, maximum = 3, value = 3, step = 1, interactive = True)
151
  denoising_steps = gr.Slider(label = "Steps", info = "lower=faster & variant, higher=audio quality & similar", minimum = 100, maximum = 200, value = 100, step = 1, interactive = True)
152
  guidance_scale = gr.Slider(label = "Guidance Scale", info = "lower=audio quality, higher=follow the prompt", minimum = 1, maximum = 10, value = 3, step = 0.1, interactive = True)
@@ -164,8 +166,10 @@ with gr.Blocks() as interface:
164
  denoising_steps,
165
  guidance_scale
166
  ], outputs = [], queue = False, show_progress = False).success(fn = update_output, inputs = [
 
167
  output_number
168
  ], outputs = [
 
169
  output_audio_2,
170
  output_audio_3
171
  ], queue = False, show_progress = False).success(fn = text2audio, inputs = [
 
92
  if not output_number in [1, 2, 3]:
93
  raise gr.Error("Please ask for 1, 2 or 3 output files.")
94
 
95
+ def update_output(output_format, output_number):
96
  return [
97
+ gr.update(format = output_format),
98
+ gr.update(format = output_format, visible = (2 <= output_number)),
99
+ gr.update(format = output_format, visible = (output_number == 3))
100
  ]
101
 
102
  def text2audio(
 
148
  )
149
  input_text = gr.Textbox(label = "Prompt", value = "Snort of a horse", lines = 2, autofocus = True)
150
  with gr.Accordion("Advanced options", open = False):
151
+ output_format = gr.Radio(label = "Output format", info = "The file you can dowload", choices = ["mp3", "wav"], value = "wav")
152
  output_number = gr.Slider(label = "Number of generations", info = "1, 2 or 3 output files", minimum = 1, maximum = 3, value = 3, step = 1, interactive = True)
153
  denoising_steps = gr.Slider(label = "Steps", info = "lower=faster & variant, higher=audio quality & similar", minimum = 100, maximum = 200, value = 100, step = 1, interactive = True)
154
  guidance_scale = gr.Slider(label = "Guidance Scale", info = "lower=audio quality, higher=follow the prompt", minimum = 1, maximum = 10, value = 3, step = 0.1, interactive = True)
 
166
  denoising_steps,
167
  guidance_scale
168
  ], outputs = [], queue = False, show_progress = False).success(fn = update_output, inputs = [
169
+ output_format,
170
  output_number
171
  ], outputs = [
172
+ output_audio_1,
173
  output_audio_2,
174
  output_audio_3
175
  ], queue = False, show_progress = False).success(fn = text2audio, inputs = [