Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3002,6 +3002,20 @@ Response:
|
|
| 3002 |
send_whatsjet_message(from_number, error_msg)
|
| 3003 |
|
| 3004 |
# Load products on startup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3005 |
load_products_data()
|
| 3006 |
|
| 3007 |
# Add these functions after the existing imports and before the main functions
|
|
@@ -3485,21 +3499,6 @@ async def test_cpanel_image_access():
|
|
| 3485 |
"timestamp": datetime.now().isoformat()
|
| 3486 |
}
|
| 3487 |
|
| 3488 |
-
# Load products on startup
|
| 3489 |
-
def load_products_data():
|
| 3490 |
-
"""Load products data from CSV file"""
|
| 3491 |
-
global products_df
|
| 3492 |
-
try:
|
| 3493 |
-
if os.path.exists(CSV_FILE):
|
| 3494 |
-
products_df = pd.read_csv(CSV_FILE)
|
| 3495 |
-
logger.info(f"✅ Loaded {len(products_df)} products from {CSV_FILE}")
|
| 3496 |
-
else:
|
| 3497 |
-
logger.warning(f"⚠️ CSV file {CSV_FILE} not found")
|
| 3498 |
-
products_df = pd.DataFrame()
|
| 3499 |
-
except Exception as e:
|
| 3500 |
-
logger.error(f"❌ Error loading products data: {e}")
|
| 3501 |
-
products_df = pd.DataFrame()
|
| 3502 |
-
|
| 3503 |
def convert_drive_link(link: str) -> str:
|
| 3504 |
"""Convert Google Drive link to direct download link"""
|
| 3505 |
if 'drive.google.com' in link:
|
|
|
|
| 3002 |
send_whatsjet_message(from_number, error_msg)
|
| 3003 |
|
| 3004 |
# Load products on startup
|
| 3005 |
+
def load_products_data():
|
| 3006 |
+
"""Load products data from CSV file"""
|
| 3007 |
+
global products_df
|
| 3008 |
+
try:
|
| 3009 |
+
if os.path.exists(CSV_FILE):
|
| 3010 |
+
products_df = pd.read_csv(CSV_FILE)
|
| 3011 |
+
logger.info(f"✅ Loaded {len(products_df)} products from {CSV_FILE}")
|
| 3012 |
+
else:
|
| 3013 |
+
logger.warning(f"⚠️ CSV file {CSV_FILE} not found")
|
| 3014 |
+
products_df = pd.DataFrame()
|
| 3015 |
+
except Exception as e:
|
| 3016 |
+
logger.error(f"❌ Error loading products data: {e}")
|
| 3017 |
+
products_df = pd.DataFrame()
|
| 3018 |
+
|
| 3019 |
load_products_data()
|
| 3020 |
|
| 3021 |
# Add these functions after the existing imports and before the main functions
|
|
|
|
| 3499 |
"timestamp": datetime.now().isoformat()
|
| 3500 |
}
|
| 3501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3502 |
def convert_drive_link(link: str) -> str:
|
| 3503 |
"""Convert Google Drive link to direct download link"""
|
| 3504 |
if 'drive.google.com' in link:
|