Spaces:
Running
Running
Commit
·
13067a4
1
Parent(s):
1a693af
[ADD] try catch loading model
Browse files
app.py
CHANGED
|
@@ -16,11 +16,11 @@ model_cache = {}
|
|
| 16 |
def get_model(model_name: str) -> GLiNER:
|
| 17 |
"""Get model from cache or load it if not cached."""
|
| 18 |
if model_name not in model_cache:
|
| 19 |
-
|
| 20 |
try:
|
| 21 |
model_cache[model_name] = GLiNER.from_pretrained(model_name)
|
| 22 |
except Exception as e:
|
| 23 |
-
|
| 24 |
raise e
|
| 25 |
return model_cache[model_name]
|
| 26 |
|
|
|
|
| 16 |
def get_model(model_name: str) -> GLiNER:
|
| 17 |
"""Get model from cache or load it if not cached."""
|
| 18 |
if model_name not in model_cache:
|
| 19 |
+
print(f"Loading model {model_name}")
|
| 20 |
try:
|
| 21 |
model_cache[model_name] = GLiNER.from_pretrained(model_name)
|
| 22 |
except Exception as e:
|
| 23 |
+
print(f"Error loading model {model_name}: {e}")
|
| 24 |
raise e
|
| 25 |
return model_cache[model_name]
|
| 26 |
|