Spaces:
Running
Running
fix making dir
Browse files
app.py
CHANGED
@@ -63,6 +63,12 @@ def clear_old_files(dir,passed_time):
|
|
63 |
|
64 |
def process_images(normal_image,mouth_open_image,eye_close_image,duration=100,pattern = "nnnmmmnenmmmnnnmmmnnnmmmnnnmmm",looping = True):
|
65 |
# validating images
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
if normal_image is None or mouth_open_image is None or eye_close_image is None:
|
67 |
raise gr.Error("Need Normal Mouth Eyes 3 images")
|
68 |
#validate check
|
@@ -108,7 +114,7 @@ def process_images(normal_image,mouth_open_image,eye_close_image,duration=100,pa
|
|
108 |
hex_dig = hash_object.hexdigest()
|
109 |
unique_id = hex_dig[:32]
|
110 |
|
111 |
-
|
112 |
output_path = f"{output_dir}/{unique_id}.webp"
|
113 |
with open(output_path,"wb") as f:
|
114 |
f.write(output_buffer.getvalue())
|
|
|
63 |
|
64 |
def process_images(normal_image,mouth_open_image,eye_close_image,duration=100,pattern = "nnnmmmnenmmmnnnmmmnnnmmmnnnmmm",looping = True):
|
65 |
# validating images
|
66 |
+
|
67 |
+
# cache control
|
68 |
+
if not os.path.exists(output_dir):
|
69 |
+
os.mkdir(output_dir)
|
70 |
+
clear_old_files(output_dir,passed_time)
|
71 |
+
|
72 |
if normal_image is None or mouth_open_image is None or eye_close_image is None:
|
73 |
raise gr.Error("Need Normal Mouth Eyes 3 images")
|
74 |
#validate check
|
|
|
114 |
hex_dig = hash_object.hexdigest()
|
115 |
unique_id = hex_dig[:32]
|
116 |
|
117 |
+
|
118 |
output_path = f"{output_dir}/{unique_id}.webp"
|
119 |
with open(output_path,"wb") as f:
|
120 |
f.write(output_buffer.getvalue())
|