zhiweili
commited on
Commit
·
a425cf8
1
Parent(s):
4279b74
fix output dir not found
Browse files- segment_utils.py +7 -1
segment_utils.py
CHANGED
@@ -29,7 +29,13 @@ def restore_result(croper, category, generated_image):
|
|
29 |
# else:
|
30 |
# extension = 'jpg'
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
restored_image.save(path, quality=100)
|
34 |
|
35 |
return restored_image, path
|
|
|
29 |
# else:
|
30 |
# extension = 'jpg'
|
31 |
|
32 |
+
tmpPrefix = "/tmp/gradio/"
|
33 |
+
|
34 |
+
targetDir = f"{tmpPrefix}output/"
|
35 |
+
if not os.path.exists(targetDir):
|
36 |
+
os.makedirs(targetDir)
|
37 |
+
|
38 |
+
path = f"{targetDir}{uuid.uuid4()}.{extension}"
|
39 |
restored_image.save(path, quality=100)
|
40 |
|
41 |
return restored_image, path
|