Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -85,9 +85,9 @@ def fourier_transform_drawing(input_image, frames, coefficients, img_size, blur_
|
|
85 |
# Convert the Matplotlib figure to a PIL Image
|
86 |
canvas = fig.canvas
|
87 |
canvas.draw()
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
last_image = image
|
92 |
|
93 |
# Yield the current image and a placeholder for the final animation
|
|
|
85 |
# Convert the Matplotlib figure to a PIL Image
|
86 |
canvas = fig.canvas
|
87 |
canvas.draw()
|
88 |
+
w, h = canvas.get_width_height()
|
89 |
+
buf = np.frombuffer(canvas.buffer_rgba(), dtype=np.uint8)
|
90 |
+
image = Image.fromarray(buf.reshape(h, w, 4), 'RGBA').convert('RGB')
|
91 |
last_image = image
|
92 |
|
93 |
# Yield the current image and a placeholder for the final animation
|