Spaces:
Running
on
Zero
Running
on
Zero
clean up tmp dir after each run
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ from typing import Any, Mapping, Sequence, Union
|
|
6 |
import gradio as gr
|
7 |
import numpy as np
|
8 |
import spaces
|
|
|
9 |
import torch
|
10 |
import yaml
|
11 |
from huggingface_hub import hf_hub_download
|
@@ -208,9 +209,9 @@ def clear_tmp_directory():
|
|
208 |
full_path = os.path.join(root, file)
|
209 |
try:
|
210 |
os.remove(full_path)
|
211 |
-
print(
|
212 |
except Exception as e:
|
213 |
-
print(
|
214 |
|
215 |
|
216 |
add_comfyui_directory_to_sys_path()
|
@@ -219,6 +220,7 @@ add_extra_model_paths()
|
|
219 |
|
220 |
@spaces.GPU(duration=60)
|
221 |
def advance_blur(input_image):
|
|
|
222 |
with torch.inference_mode():
|
223 |
loaded_input_image = loadimage.load_image(
|
224 |
image=input_image,
|
@@ -282,6 +284,11 @@ def advance_blur(input_image):
|
|
282 |
# Clean up the /tmp directory
|
283 |
clear_tmp_directory()
|
284 |
|
|
|
|
|
|
|
|
|
|
|
285 |
return outpath
|
286 |
|
287 |
|
|
|
6 |
import gradio as gr
|
7 |
import numpy as np
|
8 |
import spaces
|
9 |
+
import time
|
10 |
import torch
|
11 |
import yaml
|
12 |
from huggingface_hub import hf_hub_download
|
|
|
209 |
full_path = os.path.join(root, file)
|
210 |
try:
|
211 |
os.remove(full_path)
|
212 |
+
print("Deleted an image.")
|
213 |
except Exception as e:
|
214 |
+
print("Failed to delete an image.")
|
215 |
|
216 |
|
217 |
add_comfyui_directory_to_sys_path()
|
|
|
220 |
|
221 |
@spaces.GPU(duration=60)
|
222 |
def advance_blur(input_image):
|
223 |
+
start_time = time.time()
|
224 |
with torch.inference_mode():
|
225 |
loaded_input_image = loadimage.load_image(
|
226 |
image=input_image,
|
|
|
284 |
# Clean up the /tmp directory
|
285 |
clear_tmp_directory()
|
286 |
|
287 |
+
# Log the time taken for the process
|
288 |
+
end_time = time.time()
|
289 |
+
elapsed_time = end_time - start_time
|
290 |
+
print(f"Processing time: {elapsed_time:.2f} seconds")
|
291 |
+
|
292 |
return outpath
|
293 |
|
294 |
|