selvaonline commited on
Commit
1ba7ad7
·
verified ·
1 Parent(s): 01a69ef

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -378,20 +378,22 @@ def load_deals_from_file():
378
  # Global variable to store deals data
379
  deals_cache = None
380
 
381
- # Try to fetch and save deals on startup
382
  try:
383
- # First try to load from file
384
  deals_cache = load_deals_from_file()
385
 
386
- # If file doesn't exist or is empty, fetch and save
387
  if deals_cache is None or len(deals_cache) == 0:
388
- print("No deals found in local file. Fetching deals...")
389
- deals_cache = fetch_and_save_deals()
390
 
391
  print(f"Initialized with {len(deals_cache) if deals_cache else 0} deals")
392
  except Exception as e:
393
  print(f"Error initializing deals cache: {str(e)}")
394
- deals_cache = None
 
 
395
 
396
  def classify_text(text, fetch_deals=True):
397
  """
 
378
  # Global variable to store deals data
379
  deals_cache = None
380
 
381
+ # Load deals from file on startup
382
  try:
383
+ # Try to load from file
384
  deals_cache = load_deals_from_file()
385
 
386
+ # If file doesn't exist or is empty, use sample data
387
  if deals_cache is None or len(deals_cache) == 0:
388
+ print("No deals found in local file. Using sample data...")
389
+ deals_cache = process_deals_data(SAMPLE_DEALS)
390
 
391
  print(f"Initialized with {len(deals_cache) if deals_cache else 0} deals")
392
  except Exception as e:
393
  print(f"Error initializing deals cache: {str(e)}")
394
+ # Fall back to sample data
395
+ deals_cache = process_deals_data(SAMPLE_DEALS)
396
+ print(f"Initialized with {len(deals_cache)} sample deals")
397
 
398
  def classify_text(text, fetch_deals=True):
399
  """