sayed99 commited on
Commit
0debe4c
·
1 Parent(s): 14bad24

handle dir exist error for the remote deployed.

Browse files
Files changed (1) hide show
  1. tools/image_generation.py +6 -2
tools/image_generation.py CHANGED
@@ -41,8 +41,12 @@ class ImageGenerationTool(Tool):
41
  )
42
 
43
  image_path = result[0][0]['image']
44
- save_path = Path(os.getcwd()) / "generations" / \
45
- f"generated_image_{uuid.uuid4().hex}.png"
 
 
 
 
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}")