Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2530,6 +2530,7 @@ def get_product_image_path(product_name: str) -> str:
|
|
2530 |
# Try normalized name (with dashes preserved)
|
2531 |
for ext in image_extensions:
|
2532 |
image_url = f"{base_url}{normalized_name}{ext}"
|
|
|
2533 |
try:
|
2534 |
resp = requests.head(image_url, timeout=5)
|
2535 |
if resp.status_code == 200:
|
@@ -2541,6 +2542,7 @@ def get_product_image_path(product_name: str) -> str:
|
|
2541 |
safe_name = product_name.strip().replace(' ', '%20')
|
2542 |
for ext in image_extensions:
|
2543 |
image_url = f"{base_url}{safe_name}{ext}"
|
|
|
2544 |
try:
|
2545 |
resp = requests.head(image_url, timeout=5)
|
2546 |
if resp.status_code == 200:
|
@@ -2550,6 +2552,7 @@ def get_product_image_path(product_name: str) -> str:
|
|
2550 |
logger.warning(f"[Image] Error checking image URL {image_url}: {e}")
|
2551 |
# Default image fallback
|
2552 |
default_image_url = f"{base_url}default_product.jpg"
|
|
|
2553 |
try:
|
2554 |
resp = requests.head(default_image_url, timeout=5)
|
2555 |
if resp.status_code == 200:
|
|
|
2530 |
# Try normalized name (with dashes preserved)
|
2531 |
for ext in image_extensions:
|
2532 |
image_url = f"{base_url}{normalized_name}{ext}"
|
2533 |
+
logger.info(f"[Image] Checking normalized image URL: {image_url}")
|
2534 |
try:
|
2535 |
resp = requests.head(image_url, timeout=5)
|
2536 |
if resp.status_code == 200:
|
|
|
2542 |
safe_name = product_name.strip().replace(' ', '%20')
|
2543 |
for ext in image_extensions:
|
2544 |
image_url = f"{base_url}{safe_name}{ext}"
|
2545 |
+
logger.info(f"[Image] Checking fallback image URL: {image_url}")
|
2546 |
try:
|
2547 |
resp = requests.head(image_url, timeout=5)
|
2548 |
if resp.status_code == 200:
|
|
|
2552 |
logger.warning(f"[Image] Error checking image URL {image_url}: {e}")
|
2553 |
# Default image fallback
|
2554 |
default_image_url = f"{base_url}default_product.jpg"
|
2555 |
+
logger.info(f"[Image] Checking default image URL: {default_image_url}")
|
2556 |
try:
|
2557 |
resp = requests.head(default_image_url, timeout=5)
|
2558 |
if resp.status_code == 200:
|