fix recursion error mess
This commit is contained in:
parent
a4d297fc33
commit
d81d955a8b
15
alpr_api.py
15
alpr_api.py
@ -75,7 +75,9 @@ config = json.dumps(JSON_CONFIG)
|
||||
|
||||
|
||||
def start_backend_loop():
|
||||
global counter
|
||||
global counter, boot_time
|
||||
|
||||
while True:
|
||||
load_engine()
|
||||
|
||||
# loop for about an hour or 3000 requests then reload the engine (fix for trial license)
|
||||
@ -86,10 +88,13 @@ def start_backend_loop():
|
||||
unload_engine() # just in case
|
||||
load_engine()
|
||||
|
||||
sleep(1)
|
||||
time.sleep(1)
|
||||
|
||||
unload_engine()
|
||||
start_backend_loop()
|
||||
|
||||
# Reset counter and boot_time to restart the loop
|
||||
counter = 0
|
||||
boot_time = time.time()
|
||||
|
||||
|
||||
def is_engine_loaded():
|
||||
@ -282,8 +287,8 @@ def find_best_plate_with_split(image: Image, grid_size: int = None, wanted_cells
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
engine = threading.Thread(target=start_backend_loop, daemon=True)
|
||||
engine.start()
|
||||
engine_thread = threading.Thread(target=start_backend_loop, daemon=True)
|
||||
engine_thread.start()
|
||||
|
||||
app = create_rest_server_flask()
|
||||
app.run(host='0.0.0.0', port=5000)
|
||||
|
Loading…
Reference in New Issue
Block a user