Update app.py
Browse files
app.py
CHANGED
@@ -50,4 +50,23 @@ def create_gif(frames):
|
|
50 |
return gif_buffer
|
51 |
|
52 |
def process_image(image, grid_size):
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
return gif_buffer
|
51 |
|
52 |
def process_image(image, grid_size):
|
53 |
+
# Split the image into frames
|
54 |
+
frames = split_image_grid(image, grid_size)
|
55 |
+
# Create a zip file from the frames
|
56 |
+
zip_file = create_zip_file(frames)
|
57 |
+
# Create a GIF from the frames
|
58 |
+
gif_file = create_gif(frames)
|
59 |
+
return zip_file, gif_file
|
60 |
+
|
61 |
+
with gr.Blocks() as demo:
|
62 |
+
with gr.Row():
|
63 |
+
image_input = gr.Image(type="pil", label="Input Image")
|
64 |
+
grid_size_slider = gr.Slider(1, 10, value=2, step=1, label="Grid Size")
|
65 |
+
with gr.Row():
|
66 |
+
zip_output = gr.File(label="Download ZIP")
|
67 |
+
gif_output = gr.Image(label="Generated GIF")
|
68 |
+
process_button = gr.Button("Process Image")
|
69 |
+
|
70 |
+
process_button.click(process_image, inputs=[image_input, grid_size_slider], outputs=[zip_output, gif_output])
|
71 |
+
|
72 |
+
demo.launch(show_error=True)
|