Hjgugugjhuhjggg
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -99,6 +99,17 @@ model_configs = [
|
|
99 |
}
|
100 |
]
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
class ModelManager:
|
103 |
def __init__(self):
|
104 |
self.models = {}
|
@@ -114,7 +125,7 @@ class ModelManager:
|
|
114 |
use_gpu=False
|
115 |
)
|
116 |
except Exception as e:
|
117 |
-
|
118 |
|
119 |
def load_all_models(self):
|
120 |
with ThreadPoolExecutor() as executor:
|
|
|
99 |
}
|
100 |
]
|
101 |
|
102 |
+
# Asegur茅monos de que la funci贸n de cach茅 est茅 definida antes de su uso
|
103 |
+
def cache_response(func):
|
104 |
+
def wrapper(*args, **kwargs):
|
105 |
+
cache_key = f"{args}-{kwargs}"
|
106 |
+
if cache_key in cache:
|
107 |
+
return cache[cache_key]
|
108 |
+
response = func(*args, **kwargs)
|
109 |
+
cache[cache_key] = response
|
110 |
+
return response
|
111 |
+
return wrapper
|
112 |
+
|
113 |
class ModelManager:
|
114 |
def __init__(self):
|
115 |
self.models = {}
|
|
|
125 |
use_gpu=False
|
126 |
)
|
127 |
except Exception as e:
|
128 |
+
print(f"Error loading model {model_config['name']}: {e}")
|
129 |
|
130 |
def load_all_models(self):
|
131 |
with ThreadPoolExecutor() as executor:
|