Spaces:
Running
Running
Update app2.py
Browse files
app2.py
CHANGED
@@ -346,16 +346,17 @@ def generate_qr_code(data: Union[str, Dict], combined: bool = True) -> List[str]
|
|
346 |
img.save(str(output_path))
|
347 |
return [str(output_path)]
|
348 |
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
|
354 |
def decode_qr_code(image_path: str) -> str:
|
355 |
"""Decode QR code from an image file"""
|
356 |
try:
|
357 |
img = Image.open(image_path)
|
358 |
-
decoded_objects = decode(img
|
|
|
359 |
return decoded_objects[0].data.decode('utf-8')
|
360 |
raise ValueError("Unable to decode QR code")
|
361 |
except Exception as e:
|
|
|
346 |
img.save(str(output_path))
|
347 |
return [str(output_path)]
|
348 |
|
349 |
+
return []
|
350 |
+
except Exception as e:
|
351 |
+
logger.error(f"QR generation error: {e}")
|
352 |
+
return []
|
353 |
|
354 |
def decode_qr_code(image_path: str) -> str:
|
355 |
"""Decode QR code from an image file"""
|
356 |
try:
|
357 |
img = Image.open(image_path)
|
358 |
+
decoded_objects = decode(img
|
359 |
+
if decoded_objects:
|
360 |
return decoded_objects[0].data.decode('utf-8')
|
361 |
raise ValueError("Unable to decode QR code")
|
362 |
except Exception as e:
|