Omnibus commited on
Commit
864e9e3
·
1 Parent(s): aa56dd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,8 +1,17 @@
1
  import gradio as gr
2
  import utils
3
 
 
 
 
 
 
 
 
 
4
  with gr.Blocks() as app:
5
  with gr.Tab("Add Watermark"):
 
6
  with gr.Row():
7
  with gr.Column():
8
  inp_im = gr.Image(label="Input Image",type="filepath")
@@ -18,6 +27,6 @@ with gr.Blocks() as app:
18
  det_btn = gr.Button("Detect")
19
  with gr.Column():
20
  det_msg = gr.Textbox(label="Detected Watermark",lines=6, max_lines=50)
21
- mark_btn.click(utils.encode,[inp_im,inp_mark],[out_im,msg_box])
22
  det_btn.click(utils.decode,[det_im],det_msg)
23
  app.launch()
 
1
  import gradio as gr
2
  import utils
3
 
4
+ def choose_encode(inp_im,inp_mark,cho):
5
+ if cho == "stegan":
6
+ out_im, out_msg = utils.encode(inp_im,inp_mark)
7
+ return out_im,out_msg
8
+ if cho == "pnginfo"
9
+ out_im, out_msg = utils.png_encode(inp_im,inp_mark)
10
+ return out_im,out_msg
11
+
12
  with gr.Blocks() as app:
13
  with gr.Tab("Add Watermark"):
14
+ cho = gr.Radio(choices=["stegan","pnginfo"])
15
  with gr.Row():
16
  with gr.Column():
17
  inp_im = gr.Image(label="Input Image",type="filepath")
 
27
  det_btn = gr.Button("Detect")
28
  with gr.Column():
29
  det_msg = gr.Textbox(label="Detected Watermark",lines=6, max_lines=50)
30
+ mark_btn.click(choose_encode,[inp_im,inp_mark,cho],[out_im,msg_box])
31
  det_btn.click(utils.decode,[det_im],det_msg)
32
  app.launch()