Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -19,9 +19,9 @@ def decode(im,col):
|
|
19 |
rgb_tup = tuple(int(h1[i:i+2], 16) for i in (0, 2, 4))
|
20 |
for item in datas:
|
21 |
if item[0] == rgb_tup[0] and item[1] == rgb_tup[1] and item[2] == rgb_tup[2]:
|
22 |
-
newData.append(0,0,0)
|
23 |
else:
|
24 |
-
newData.append(255,255,255)
|
25 |
qr_img.putdata(newData)
|
26 |
qr_img.save('conv_im.png')
|
27 |
img = cv2.imread('conv_im.png')
|
@@ -34,10 +34,13 @@ def decode(im,col):
|
|
34 |
|
35 |
|
36 |
with gr.Blocks() as app:
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
41 |
|
42 |
dec_btn.click(decode,[in_im,choose_color],text_out)
|
43 |
app.queue(concurrency_count=10).launch()
|
|
|
19 |
rgb_tup = tuple(int(h1[i:i+2], 16) for i in (0, 2, 4))
|
20 |
for item in datas:
|
21 |
if item[0] == rgb_tup[0] and item[1] == rgb_tup[1] and item[2] == rgb_tup[2]:
|
22 |
+
newData.append((0,0,0))
|
23 |
else:
|
24 |
+
newData.append((255,255,255))
|
25 |
qr_img.putdata(newData)
|
26 |
qr_img.save('conv_im.png')
|
27 |
img = cv2.imread('conv_im.png')
|
|
|
34 |
|
35 |
|
36 |
with gr.Blocks() as app:
|
37 |
+
with gr.Row():
|
38 |
+
with gr.Column():
|
39 |
+
in_im = gr.Image(label="QR Image to Decode",type='filepath')
|
40 |
+
with gr.Column():
|
41 |
+
choose_color = gr.ColorPicker(label="Choose QR color (eyedropper)")
|
42 |
+
dec_btn = gr.Button("Decode QR")
|
43 |
+
text_out = gr.Textbox(label="Decoded Text")
|
44 |
|
45 |
dec_btn.click(decode,[in_im,choose_color],text_out)
|
46 |
app.queue(concurrency_count=10).launch()
|