avsolatorio commited on
Commit
042389b
·
1 Parent(s): 123d671

Remove duration and add time log

Browse files

Signed-off-by: Aivin V. Solatorio <[email protected]>

Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -23,8 +23,10 @@ def get_model(model_name: str = None):
23
  global _MODEL
24
 
25
  if _MODEL.get(model_name) is None:
 
26
  _MODEL[model_name] = GLiNER.from_pretrained(model_name, cache_dir=_CACHE_DIR)
27
  _MODEL[model_name].to("cuda")
 
28
 
29
  return _MODEL[model_name]
30
 
@@ -36,7 +38,7 @@ def get_country(country_name: str):
36
  return None
37
 
38
 
39
- @spaces.GPU(duration=10)
40
  def predict_entities(model, query: str, labels: Union[str, list], threshold: float = 0.3, nested_ner: bool = False):
41
  start = datetime.now()
42
 
 
23
  global _MODEL
24
 
25
  if _MODEL.get(model_name) is None:
26
+ start = datetime.now()
27
  _MODEL[model_name] = GLiNER.from_pretrained(model_name, cache_dir=_CACHE_DIR)
28
  _MODEL[model_name].to("cuda")
29
+ print(f"{datetime.now()} :: get_model :: {datetime.now() - start}")
30
 
31
  return _MODEL[model_name]
32
 
 
38
  return None
39
 
40
 
41
+ @spaces.GPU
42
  def predict_entities(model, query: str, labels: Union[str, list], threshold: float = 0.3, nested_ner: bool = False):
43
  start = datetime.now()
44