Upload modutils.py
Browse files- modutils.py +2 -2
modutils.py
CHANGED
|
@@ -338,7 +338,7 @@ def save_image_history(image, gallery, files, model_name: str, progress=gr.Progr
|
|
| 338 |
if image is None or not isinstance(image, (str, Image.Image, np.ndarray, tuple)): return gr.update(), gr.update()
|
| 339 |
filename = f"{basename}.png"
|
| 340 |
if isinstance(image, tuple): image = image[0]
|
| 341 |
-
if isinstance(image, str): oldpath =
|
| 342 |
elif isinstance(image, Image.Image):
|
| 343 |
oldpath = "temp.png"
|
| 344 |
image.save(oldpath)
|
|
@@ -346,7 +346,7 @@ def save_image_history(image, gallery, files, model_name: str, progress=gr.Progr
|
|
| 346 |
oldpath = "temp.png"
|
| 347 |
Image.fromarray(image).convert('RGBA').save(oldpath)
|
| 348 |
newpath = oldpath
|
| 349 |
-
if oldpath.exists():
|
| 350 |
shutil.copy(oldpath.resolve(), Path(filename).resolve())
|
| 351 |
newpath = Path(filename).resolve()
|
| 352 |
files.insert(0, str(newpath))
|
|
|
|
| 338 |
if image is None or not isinstance(image, (str, Image.Image, np.ndarray, tuple)): return gr.update(), gr.update()
|
| 339 |
filename = f"{basename}.png"
|
| 340 |
if isinstance(image, tuple): image = image[0]
|
| 341 |
+
if isinstance(image, str): oldpath = image
|
| 342 |
elif isinstance(image, Image.Image):
|
| 343 |
oldpath = "temp.png"
|
| 344 |
image.save(oldpath)
|
|
|
|
| 346 |
oldpath = "temp.png"
|
| 347 |
Image.fromarray(image).convert('RGBA').save(oldpath)
|
| 348 |
newpath = oldpath
|
| 349 |
+
if Path(oldpath).exists():
|
| 350 |
shutil.copy(oldpath.resolve(), Path(filename).resolve())
|
| 351 |
newpath = Path(filename).resolve()
|
| 352 |
files.insert(0, str(newpath))
|