Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import qrcode
|
2 |
-
|
3 |
from PIL import Image
|
4 |
import gradio as gr
|
5 |
import tempfile
|
@@ -23,13 +23,11 @@ def generate_qr(data):
|
|
23 |
temp_file.close() # Close the file to flush contents to disk
|
24 |
return temp_file.name
|
25 |
|
26 |
-
# Function to read a QR code
|
27 |
-
def
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
else:
|
32 |
-
return "No QR code found."
|
33 |
|
34 |
# Custom CSS styling as HTML for dark mode
|
35 |
custom_css = """
|
|
|
1 |
import qrcode
|
2 |
+
import cv2
|
3 |
from PIL import Image
|
4 |
import gradio as gr
|
5 |
import tempfile
|
|
|
23 |
temp_file.close() # Close the file to flush contents to disk
|
24 |
return temp_file.name
|
25 |
|
26 |
+
# Function to read a QR code using OpenCV
|
27 |
+
def read_qr_with_opencv(img):
|
28 |
+
detector = cv2.QRCodeDetector()
|
29 |
+
data, _, _ = detector.detectAndDecode(img)
|
30 |
+
return data if data else "No QR code found."
|
|
|
|
|
31 |
|
32 |
# Custom CSS styling as HTML for dark mode
|
33 |
custom_css = """
|