Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
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 |
-
#
|
382 |
try:
|
383 |
-
#
|
384 |
deals_cache = load_deals_from_file()
|
385 |
|
386 |
-
# If file doesn't exist or is empty,
|
387 |
if deals_cache is None or len(deals_cache) == 0:
|
388 |
-
print("No deals found in local file.
|
389 |
-
deals_cache =
|
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 |
-
|
|
|
|
|
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 |
"""
|