neuralworm commited on
Commit
9983d3c
1 Parent(s): c8199e6

max phrases variable

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -14,7 +14,7 @@ from tqdm import tqdm # Import tqdm for progress bars
14
 
15
  # Constants
16
  DATABASE_FILE = 'gematria.db'
17
- MAX_PHRASE_LENGTH = 14 # Populate database for phrases up to 5 words
18
  BATCH_SIZE = 1000 # Insert phrases into database in batches
19
 
20
  # Set up logging
@@ -312,7 +312,7 @@ def run_app() -> None:
312
  # Pre-populate the database
313
  logging.info("Starting database population...")
314
  phrases_to_insert = [] # Collect phrases before inserting in bulk
315
- for max_phrase_length in range(1, MAX_PHRASE_LENGTH + 1): # Populate for phrases up to MAX_PHRASE_LENGTH words
316
  for gematria_sum, phrase, book, chapter, verse in tqdm(populate_database(1, 39, max_phrase_length=max_phrase_length), desc=f"Populating Database (Max Length: {max_phrase_length})"): # Books 1 to 39
317
  phrases_to_insert.append((gematria_sum, phrase, book, chapter, verse))
318
  if len(phrases_to_insert) >= BATCH_SIZE: # Insert in batches of BATCH_SIZE for efficiency
@@ -326,7 +326,7 @@ def run_app() -> None:
326
  fn=gematria_search_interface,
327
  inputs=[
328
  gr.Textbox(label="Enter word(s) or numbers (e.g., 'abc', '888' or 'abc 111 777')"),
329
- gr.Number(label="Max Word Count in Result Phrases", value=1, minimum=1, maximum=MAX_PHRASE_LENGTH),
330
  gr.Checkbox(label="Show Translation", value=True)
331
  ],
332
  outputs=gr.HTML(label="Results"),
 
14
 
15
  # Constants
16
  DATABASE_FILE = 'gematria.db'
17
+ MAX_PHRASE_LENGTH_LIMIT = 14 # Populate database for phrases up to 5 words
18
  BATCH_SIZE = 1000 # Insert phrases into database in batches
19
 
20
  # Set up logging
 
312
  # Pre-populate the database
313
  logging.info("Starting database population...")
314
  phrases_to_insert = [] # Collect phrases before inserting in bulk
315
+ for max_phrase_length in range(1, MAX_PHRASE_LENGTH_LIMIT + 1): # Populate for phrases up to MAX_PHRASE_LENGTH_LIMIT words
316
  for gematria_sum, phrase, book, chapter, verse in tqdm(populate_database(1, 39, max_phrase_length=max_phrase_length), desc=f"Populating Database (Max Length: {max_phrase_length})"): # Books 1 to 39
317
  phrases_to_insert.append((gematria_sum, phrase, book, chapter, verse))
318
  if len(phrases_to_insert) >= BATCH_SIZE: # Insert in batches of BATCH_SIZE for efficiency
 
326
  fn=gematria_search_interface,
327
  inputs=[
328
  gr.Textbox(label="Enter word(s) or numbers (e.g., 'abc', '888' or 'abc 111 777')"),
329
+ gr.Number(label="Max Word Count in Result Phrases", value=1, minimum=1, maximum=MAX_PHRASE_LENGTH_LIMIT),
330
  gr.Checkbox(label="Show Translation", value=True)
331
  ],
332
  outputs=gr.HTML(label="Results"),