Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -30,8 +30,6 @@ def fourier_transform_drawing(input_image, frames, coefficients):
|
|
30 |
verts = [tuple(coord) for coord in contours[largest_contour_idx].squeeze()]
|
31 |
|
32 |
xs, ys = zip(*verts)
|
33 |
-
#xs = np.asarray(xs) - np.mean(xs)
|
34 |
-
#ys = - np.asarray(ys) + np.mean(ys)
|
35 |
|
36 |
# calculate the range of xs and ys
|
37 |
x_range = np.max(xs) - np.min(xs)
|
@@ -44,8 +42,8 @@ def fourier_transform_drawing(input_image, frames, coefficients):
|
|
44 |
|
45 |
# apply scaling
|
46 |
# ys needs to be flipped vertically
|
47 |
-
xs = (xs - np.mean(xs)) * scale_factor_x
|
48 |
-
ys = (-ys + np.mean(ys)) * scale_factor_y
|
49 |
|
50 |
t_list = np.linspace(0, tau, len(xs))
|
51 |
|
@@ -119,7 +117,8 @@ interface = gr.Interface(
|
|
119 |
outputs=gr.Video(),
|
120 |
title="Fourier Transform Drawing",
|
121 |
description="Upload an image and generate a Fourier Transform drawing animation."
|
|
|
122 |
)
|
123 |
|
124 |
if __name__ == "__main__":
|
125 |
-
interface.launch()
|
|
|
30 |
verts = [tuple(coord) for coord in contours[largest_contour_idx].squeeze()]
|
31 |
|
32 |
xs, ys = zip(*verts)
|
|
|
|
|
33 |
|
34 |
# calculate the range of xs and ys
|
35 |
x_range = np.max(xs) - np.min(xs)
|
|
|
42 |
|
43 |
# apply scaling
|
44 |
# ys needs to be flipped vertically
|
45 |
+
xs = (np.asarray(xs) - np.mean(xs)) * scale_factor_x
|
46 |
+
ys = (-np.asarray(ys) + np.mean(ys)) * scale_factor_y
|
47 |
|
48 |
t_list = np.linspace(0, tau, len(xs))
|
49 |
|
|
|
117 |
outputs=gr.Video(),
|
118 |
title="Fourier Transform Drawing",
|
119 |
description="Upload an image and generate a Fourier Transform drawing animation."
|
120 |
+
examples=[["Fourier2.jpg", 100, 25]]
|
121 |
)
|
122 |
|
123 |
if __name__ == "__main__":
|
124 |
+
interface.launch(cache_examples=True)
|