Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
-
import
|
| 4 |
|
| 5 |
# Function to process and display the images in grid format
|
| 6 |
def create_collage(uploaded_files, grid_layout):
|
|
@@ -36,11 +36,12 @@ def create_collage(uploaded_files, grid_layout):
|
|
| 36 |
col = i % cols
|
| 37 |
collage.paste(img, (col * img.width, row * img.height))
|
| 38 |
|
| 39 |
-
# Save the collage as a PNG file in
|
| 40 |
-
|
| 41 |
-
collage.save(
|
| 42 |
-
|
| 43 |
-
|
|
|
|
| 44 |
|
| 45 |
# Gradio Interface
|
| 46 |
with gr.Blocks() as app:
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
# Function to process and display the images in grid format
|
| 6 |
def create_collage(uploaded_files, grid_layout):
|
|
|
|
| 36 |
col = i % cols
|
| 37 |
collage.paste(img, (col * img.width, row * img.height))
|
| 38 |
|
| 39 |
+
# Save the collage as a PNG file in a temporary directory
|
| 40 |
+
output_path = "temp_collage.png"
|
| 41 |
+
collage.save(output_path, format="PNG")
|
| 42 |
+
|
| 43 |
+
# Return the file path for download
|
| 44 |
+
return output_path
|
| 45 |
|
| 46 |
# Gradio Interface
|
| 47 |
with gr.Blocks() as app:
|