zhiweili
commited on
Commit
·
a3f4f47
1
Parent(s):
df75ec5
fix no such file error
Browse files- segment_utils.py +4 -0
segment_utils.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import numpy as np
|
| 2 |
import mediapipe as mp
|
| 3 |
import uuid
|
|
|
|
| 4 |
|
| 5 |
from PIL import Image
|
| 6 |
from mediapipe.tasks import python
|
|
@@ -28,6 +29,9 @@ def restore_result(croper, category, generated_image):
|
|
| 28 |
extension = 'png'
|
| 29 |
else:
|
| 30 |
extension = 'jpg'
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
path = f"output/{uuid.uuid4()}.{extension}"
|
| 33 |
restored_image.save(path, quality=100)
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import mediapipe as mp
|
| 3 |
import uuid
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
from PIL import Image
|
| 7 |
from mediapipe.tasks import python
|
|
|
|
| 29 |
extension = 'png'
|
| 30 |
else:
|
| 31 |
extension = 'jpg'
|
| 32 |
+
|
| 33 |
+
if not os.path.exists("output"):
|
| 34 |
+
os.makedirs("output")
|
| 35 |
|
| 36 |
path = f"output/{uuid.uuid4()}.{extension}"
|
| 37 |
restored_image.save(path, quality=100)
|