Fabrice-TIERCELIN commited on
Commit
b8d94a7
β€’
1 Parent(s): 02b252c

Keep output

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -126,6 +126,15 @@ def text2audio(
126
  gr.update(visible = True, value = "Start again to get a different result. The output have been generated in " + ((str(hours) + " h, ") if hours != 0 else "") + ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + str(secondes) + " sec.")
127
  ]
128
 
 
 
 
 
 
 
 
 
 
129
  # Gradio interface
130
  with gr.Blocks() as interface:
131
  gr.Markdown("""
@@ -151,7 +160,7 @@ with gr.Blocks() as interface:
151
  with gr.Accordion("Advanced options", open = False):
152
  output_format = gr.Radio(label = "Output format", info = "The file you can dowload", choices = ["mp3", "wav"], value = "wav")
153
  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)
154
- denoising_steps = gr.Slider(label = "Steps", info = "lower=faster & variant, higher=audio quality & similar", minimum = 100, maximum = 200, value = 100, step = 1, interactive = True)
155
  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)
156
 
157
  submit = gr.Button("πŸš€ Generate", variant = "primary")
@@ -184,7 +193,15 @@ with gr.Blocks() as interface:
184
  output_audio_2,
185
  output_audio_3,
186
  information
187
- ], scroll_to_output = True)
 
 
 
 
 
 
 
 
188
 
189
  gr.Examples(
190
  fn = text2audio,
 
126
  gr.update(visible = True, value = "Start again to get a different result. The output have been generated in " + ((str(hours) + " h, ") if hours != 0 else "") + ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + str(secondes) + " sec.")
127
  ]
128
 
129
+ def keep_output(output_format, output_number):
130
+ time.sleep(3 * 60 * 60)
131
+ return [
132
+ gr.update(format = output_format),
133
+ gr.update(format = output_format, visible = (2 <= output_number)),
134
+ gr.update(format = output_format, visible = (output_number == 3)),
135
+ gr.update(visible = False)
136
+ ]
137
+
138
  # Gradio interface
139
  with gr.Blocks() as interface:
140
  gr.Markdown("""
 
160
  with gr.Accordion("Advanced options", open = False):
161
  output_format = gr.Radio(label = "Output format", info = "The file you can dowload", choices = ["mp3", "wav"], value = "wav")
162
  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)
163
+ denoising_steps = gr.Slider(label = "Steps", info = "lower=faster & variant, higher=audio quality & similar", minimum = 10, maximum = 200, value = 10, step = 1, interactive = True)
164
  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)
165
 
166
  submit = gr.Button("πŸš€ Generate", variant = "primary")
 
193
  output_audio_2,
194
  output_audio_3,
195
  information
196
+ ], scroll_to_output = True).success(fn = keep_output, inputs = [
197
+ output_format,
198
+ output_number
199
+ ], outputs = [
200
+ output_audio_1,
201
+ output_audio_2,
202
+ output_audio_3,
203
+ information
204
+ ], queue = True, show_progress = False)
205
 
206
  gr.Examples(
207
  fn = text2audio,