Spaces:
Runtime error
Runtime error
Create backupapp.py
Browse files- backupapp.py +35 -0
backupapp.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
from camera_input_live import camera_input_live
|
4 |
+
|
5 |
+
#image = camera_input_live()
|
6 |
+
|
7 |
+
#if image:
|
8 |
+
# st.image(image)
|
9 |
+
|
10 |
+
import cv2
|
11 |
+
import numpy as np
|
12 |
+
import streamlit as st
|
13 |
+
from camera_input_live import camera_input_live
|
14 |
+
|
15 |
+
"# Streamlit camera input live Demo"
|
16 |
+
"## Try holding a qr code in front of your webcam"
|
17 |
+
|
18 |
+
image = camera_input_live()
|
19 |
+
|
20 |
+
if image is not None:
|
21 |
+
st.image(image)
|
22 |
+
bytes_data = image.getvalue()
|
23 |
+
cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
|
24 |
+
|
25 |
+
detector = cv2.QRCodeDetector()
|
26 |
+
|
27 |
+
data, bbox, straight_qrcode = detector.detectAndDecode(cv2_img)
|
28 |
+
|
29 |
+
if data:
|
30 |
+
st.write("# Found QR code")
|
31 |
+
st.write(data)
|
32 |
+
with st.expander("Show details"):
|
33 |
+
st.write("BBox:", bbox)
|
34 |
+
st.write("Straight QR code:", straight_qrcode)
|
35 |
+
|