Fix UnboundLocalError by adding global declaration for current_model_path in unload_model

parent d53965a6
...@@ -125,6 +125,7 @@ def get_or_load_model(model_path: str): ...@@ -125,6 +125,7 @@ def get_or_load_model(model_path: str):
def unload_model(model_path: str): def unload_model(model_path: str):
"""Unload a model if it's no longer referenced.""" """Unload a model if it's no longer referenced."""
global current_model_path
if model_path in loaded_models: if model_path in loaded_models:
model, ref_count = loaded_models[model_path] model, ref_count = loaded_models[model_path]
if ref_count <= 1: if ref_count <= 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment