avsolatorio commited on
Commit
0864cfe
1 Parent(s): 49fed2a

Use the predict_entities method

Browse files

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

Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -38,13 +38,6 @@ def get_model(model_name: str = None):
38
  return _MODEL[model_name]
39
 
40
 
41
- # Initialize model here.
42
- print("Initializing models...")
43
- for model_name in MODELS:
44
- model = get_model(model_name=model_name)
45
- model.predict_entities(QUERY, LABELS, threshold=THRESHOLD)
46
-
47
-
48
  def get_country(country_name: str):
49
  try:
50
  return pycountry.countries.search_fuzzy(country_name)
@@ -87,6 +80,11 @@ def parse_query(query: str, labels: Union[str, list], threshold: float = 0.3, ne
87
  return payload
88
 
89
 
 
 
 
 
 
90
 
91
  with gr.Blocks(title="GLiNER-query-parser") as demo:
92
  gr.Markdown(
@@ -173,4 +171,4 @@ result = client.predict(
173
  api_name="/parse_query"
174
  )
175
  print(result)
176
- """
 
38
  return _MODEL[model_name]
39
 
40
 
 
 
 
 
 
 
 
41
  def get_country(country_name: str):
42
  try:
43
  return pycountry.countries.search_fuzzy(country_name)
 
80
  return payload
81
 
82
 
83
+ # Initialize model here.
84
+ print("Initializing models...")
85
+ for model_name in MODELS:
86
+ predict_entities(model_name, QUERY, LABELS, threshold=THRESHOLD)
87
+
88
 
89
  with gr.Blocks(title="GLiNER-query-parser") as demo:
90
  gr.Markdown(
 
171
  api_name="/parse_query"
172
  )
173
  print(result)
174
+ """