feat: deploy model api server to chicago-web01
This commit is contained in:
parent
515a0e6d81
commit
0cb89ddc80
6 changed files with 394 additions and 18 deletions
20
api/salience/timed_import.py
Normal file
20
api/salience/timed_import.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import sys
|
||||
import time
|
||||
|
||||
|
||||
class timed_import:
|
||||
"""Context manager for timing imports."""
|
||||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
self.start = None
|
||||
|
||||
def __enter__(self):
|
||||
sys.stdout.write(f"{self.name} ")
|
||||
sys.stdout.flush()
|
||||
self.start = time.time()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
elapsed = time.time() - self.start
|
||||
print(f"in {elapsed:.1f}s")
|
||||
Loading…
Add table
Add a link
Reference in a new issue