Spaces:
Runtime error
Runtime error
image_filename = re.sub(r"^.*[\/\\]([^\/\\]+)$", r"\1", image_path)
Browse files
app.py
CHANGED
|
@@ -16,6 +16,7 @@ import gradio as gr
|
|
| 16 |
import numpy as np
|
| 17 |
import torch
|
| 18 |
import random
|
|
|
|
| 19 |
from datetime import datetime
|
| 20 |
|
| 21 |
from PIL import Image
|
|
@@ -160,7 +161,8 @@ def export_images_to_zip(gallery) -> str:
|
|
| 160 |
with zipfile.ZipFile(tmp_zip.name, "w", compression=zipfile.ZIP_DEFLATED) as zf:
|
| 161 |
for i in range(len(gallery)):
|
| 162 |
image_path = gallery[i]
|
| 163 |
-
|
|
|
|
| 164 |
|
| 165 |
print(str(len(gallery)) + " images zipped")
|
| 166 |
return tmp_zip.name
|
|
|
|
| 16 |
import numpy as np
|
| 17 |
import torch
|
| 18 |
import random
|
| 19 |
+
import re
|
| 20 |
from datetime import datetime
|
| 21 |
|
| 22 |
from PIL import Image
|
|
|
|
| 161 |
with zipfile.ZipFile(tmp_zip.name, "w", compression=zipfile.ZIP_DEFLATED) as zf:
|
| 162 |
for i in range(len(gallery)):
|
| 163 |
image_path = gallery[i]
|
| 164 |
+
image_filename = re.sub(r"^.*[\/\\]([^\/\\]+)$", r"\1", image_path)
|
| 165 |
+
zf.write(image_path, arcname=image_filename)
|
| 166 |
|
| 167 |
print(str(len(gallery)) + " images zipped")
|
| 168 |
return tmp_zip.name
|