Omnibus commited on
Commit
f443ef8
1 Parent(s): 0a9a758

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,10 +1,11 @@
1
  import gradio as gr
2
  import zxingcpp
 
3
  from PIL import Image
4
 
5
  import cv2
6
 
7
- def decode(im,col):
8
  img = cv2.imread(f'{im}')
9
  gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
10
  blur = cv2.medianBlur(gray, 5)
@@ -48,9 +49,11 @@ with gr.Blocks() as app:
48
  in_im = gr.Image(label="QR Image to Decode",type='filepath')
49
  out_im = gr.Image(type='filepath')
50
  with gr.Column():
51
- choose_color = gr.ColorPicker(label="Choose QR color (eyedropper)")
 
 
52
  dec_btn = gr.Button("Decode QR")
53
  text_out = gr.Textbox(label="Decoded Text")
54
 
55
- dec_btn.click(decode,[in_im,choose_color],[text_out,out_im])
56
  app.queue(concurrency_count=10).launch()
 
1
  import gradio as gr
2
  import zxingcpp
3
+ import numpy as np
4
  from PIL import Image
5
 
6
  import cv2
7
 
8
+ def decode(im,col,tol):
9
  img = cv2.imread(f'{im}')
10
  gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
11
  blur = cv2.medianBlur(gray, 5)
 
49
  in_im = gr.Image(label="QR Image to Decode",type='filepath')
50
  out_im = gr.Image(type='filepath')
51
  with gr.Column():
52
+ with gr.Row():
53
+ choose_color = gr.ColorPicker(label="Choose QR color (eyedropper)")
54
+ color_tol = gr.Slider(1,255, step=1,value=50,label="Color Detect Tolerance")
55
  dec_btn = gr.Button("Decode QR")
56
  text_out = gr.Textbox(label="Decoded Text")
57
 
58
+ dec_btn.click(decode,[in_im,choose_color,color_tol],[text_out,out_im])
59
  app.queue(concurrency_count=10).launch()