Spaces:
Sleeping
Sleeping
handle dir exist error for the remote deployed.
Browse files
tools/image_generation.py
CHANGED
|
@@ -41,8 +41,12 @@ class ImageGenerationTool(Tool):
|
|
| 41 |
)
|
| 42 |
|
| 43 |
image_path = result[0][0]['image']
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
shutil.copy(image_path, save_path)
|
| 47 |
|
| 48 |
print(f"Image saved at: {save_path}")
|
|
|
|
| 41 |
)
|
| 42 |
|
| 43 |
image_path = result[0][0]['image']
|
| 44 |
+
|
| 45 |
+
output_dir = Path(os.getcwd()) / "generations"
|
| 46 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
save_path = output_dir / f"generated_image_{uuid.uuid4().hex}.png"
|
| 50 |
shutil.copy(image_path, save_path)
|
| 51 |
|
| 52 |
print(f"Image saved at: {save_path}")
|