Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ def scan_qr_code(image):
|
|
| 16 |
image (PIL.Image.Image): The uploaded image.
|
| 17 |
|
| 18 |
Returns:
|
| 19 |
-
str: The decoded QR code data.
|
| 20 |
"""
|
| 21 |
# Convert PIL image to OpenCV format
|
| 22 |
open_cv_image = np.array(image)
|
|
@@ -26,7 +26,8 @@ def scan_qr_code(image):
|
|
| 26 |
decoded_objects = decode(open_cv_image)
|
| 27 |
if decoded_objects:
|
| 28 |
for obj in decoded_objects:
|
| 29 |
-
|
|
|
|
| 30 |
return "No QR code found"
|
| 31 |
|
| 32 |
# Define the Gradio interface
|
|
|
|
| 16 |
image (PIL.Image.Image): The uploaded image.
|
| 17 |
|
| 18 |
Returns:
|
| 19 |
+
str: The decoded QR code data with a descriptive message.
|
| 20 |
"""
|
| 21 |
# Convert PIL image to OpenCV format
|
| 22 |
open_cv_image = np.array(image)
|
|
|
|
| 26 |
decoded_objects = decode(open_cv_image)
|
| 27 |
if decoded_objects:
|
| 28 |
for obj in decoded_objects:
|
| 29 |
+
decoded_data = obj.data.decode('utf-8')
|
| 30 |
+
return f"The code contains the following data: {decoded_data}"
|
| 31 |
return "No QR code found"
|
| 32 |
|
| 33 |
# Define the Gradio interface
|