Spaces:
Runtime error
Runtime error
Andrei Cozma
commited on
Commit
·
1540842
1
Parent(s):
4ba7038
Updates
Browse files
app.py
CHANGED
@@ -216,6 +216,7 @@ def onclick_process_fft(state, inp_image, mask_opacity, inverted_mask, pad):
|
|
216 |
image_phase = fft_phase_image(get_fft(image_final))
|
217 |
|
218 |
return (
|
|
|
219 |
[
|
220 |
(image_final, "Input Image (Final)"),
|
221 |
(image_mag, "FFT Magnitude (Original)"),
|
@@ -293,6 +294,7 @@ def update_image_input(state, selection):
|
|
293 |
image = np.array(image)
|
294 |
state["inp_image"] = image
|
295 |
return (
|
|
|
296 |
image,
|
297 |
[image],
|
298 |
None,
|
@@ -306,6 +308,7 @@ def clear_image_input(state):
|
|
306 |
print("clear_image_input:")
|
307 |
state["inp_image"] = None
|
308 |
return (
|
|
|
309 |
None,
|
310 |
[],
|
311 |
None,
|
@@ -419,33 +422,33 @@ with gr.Blocks(css=css) as demo:
|
|
419 |
inp_image.clear(
|
420 |
clear_image_input,
|
421 |
[state],
|
422 |
-
[inp_samples, out_gallery, out_fft_mag, out_fft_phase, out_ifft],
|
423 |
)
|
424 |
|
425 |
# Set up event listener for the Dropdown component to update the image input
|
426 |
inp_samples.change(
|
427 |
update_image_input,
|
428 |
[state, inp_samples],
|
429 |
-
[inp_image, out_gallery, out_fft_mag, out_fft_phase, out_ifft],
|
430 |
)
|
431 |
|
432 |
# Set up events for fft processing
|
433 |
btn_fft.click(
|
434 |
onclick_process_fft,
|
435 |
[state, inp_image, inp_mask_opacity, inp_invert_mask, inp_pad],
|
436 |
-
[out_gallery, out_fft_mag, out_fft_phase],
|
437 |
)
|
438 |
|
439 |
out_fft_mag.clear(
|
440 |
onclick_process_fft,
|
441 |
[state, inp_image, inp_mask_opacity, inp_invert_mask, inp_pad],
|
442 |
-
[out_gallery, out_fft_mag, out_fft_phase],
|
443 |
)
|
444 |
|
445 |
out_fft_phase.clear(
|
446 |
onclick_process_fft,
|
447 |
[state, inp_image, inp_mask_opacity, inp_invert_mask, inp_pad],
|
448 |
-
[out_gallery, out_fft_mag, out_fft_phase],
|
449 |
)
|
450 |
|
451 |
# inp_image.edit(
|
|
|
216 |
image_phase = fft_phase_image(get_fft(image_final))
|
217 |
|
218 |
return (
|
219 |
+
state,
|
220 |
[
|
221 |
(image_final, "Input Image (Final)"),
|
222 |
(image_mag, "FFT Magnitude (Original)"),
|
|
|
294 |
image = np.array(image)
|
295 |
state["inp_image"] = image
|
296 |
return (
|
297 |
+
state,
|
298 |
image,
|
299 |
[image],
|
300 |
None,
|
|
|
308 |
print("clear_image_input:")
|
309 |
state["inp_image"] = None
|
310 |
return (
|
311 |
+
state,
|
312 |
None,
|
313 |
[],
|
314 |
None,
|
|
|
422 |
inp_image.clear(
|
423 |
clear_image_input,
|
424 |
[state],
|
425 |
+
[state, inp_samples, out_gallery, out_fft_mag, out_fft_phase, out_ifft],
|
426 |
)
|
427 |
|
428 |
# Set up event listener for the Dropdown component to update the image input
|
429 |
inp_samples.change(
|
430 |
update_image_input,
|
431 |
[state, inp_samples],
|
432 |
+
[state, inp_image, out_gallery, out_fft_mag, out_fft_phase, out_ifft],
|
433 |
)
|
434 |
|
435 |
# Set up events for fft processing
|
436 |
btn_fft.click(
|
437 |
onclick_process_fft,
|
438 |
[state, inp_image, inp_mask_opacity, inp_invert_mask, inp_pad],
|
439 |
+
[state, out_gallery, out_fft_mag, out_fft_phase],
|
440 |
)
|
441 |
|
442 |
out_fft_mag.clear(
|
443 |
onclick_process_fft,
|
444 |
[state, inp_image, inp_mask_opacity, inp_invert_mask, inp_pad],
|
445 |
+
[state, out_gallery, out_fft_mag, out_fft_phase],
|
446 |
)
|
447 |
|
448 |
out_fft_phase.clear(
|
449 |
onclick_process_fft,
|
450 |
[state, inp_image, inp_mask_opacity, inp_invert_mask, inp_pad],
|
451 |
+
[state, out_gallery, out_fft_mag, out_fft_phase],
|
452 |
)
|
453 |
|
454 |
# inp_image.edit(
|