Spaces:
Running
on
Zero
Running
on
Zero
log duration
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import os
|
2 |
import time
|
|
|
3 |
from pathlib import Path
|
4 |
|
5 |
import torch
|
@@ -17,6 +18,7 @@ from esrgan_model import UpscalerESRGAN
|
|
17 |
from model import create_model
|
18 |
|
19 |
device = "cuda"
|
|
|
20 |
|
21 |
# Custom transform to pad images to square
|
22 |
class PadToSquare:
|
@@ -33,7 +35,7 @@ def timer_func(func):
|
|
33 |
def wrapper(*args, **kwargs):
|
34 |
t0 = time.time()
|
35 |
result = func(*args, **kwargs)
|
36 |
-
|
37 |
return result
|
38 |
return wrapper
|
39 |
|
|
|
1 |
import os
|
2 |
import time
|
3 |
+
import logging
|
4 |
from pathlib import Path
|
5 |
|
6 |
import torch
|
|
|
18 |
from model import create_model
|
19 |
|
20 |
device = "cuda"
|
21 |
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s', datefmt="%Y-%m-%d %H:%M:%S")
|
22 |
|
23 |
# Custom transform to pad images to square
|
24 |
class PadToSquare:
|
|
|
35 |
def wrapper(*args, **kwargs):
|
36 |
t0 = time.time()
|
37 |
result = func(*args, **kwargs)
|
38 |
+
logging.info(f"{func.__name__} took {time.time() - t0:.2f} seconds")
|
39 |
return result
|
40 |
return wrapper
|
41 |
|