Omnibus commited on
Commit
3073c44
·
verified ·
1 Parent(s): e9a035e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -7
app.py CHANGED
@@ -2,14 +2,22 @@ import gradio as gr
2
  def hide_message(reg,sec):
3
  out = reg + " " + ''.join(chr(0xE0000 + ord(ch)) for ch in sec)
4
  return out
5
-
 
6
 
7
  with gr.Blocks() as app:
8
- with gr.Row():
9
- with gr.Column():
10
- reg = gr.Textbox(label="Visible String")
11
- sec = gr.Textbox(label="Secret Message")
12
- btn=gr.Button()
13
- outp=gr.Textbox(label="Output Message")
 
 
 
 
 
 
 
14
  btn.click(hide_message,[reg,sec],outp)
15
  app.launch()
 
2
  def hide_message(reg,sec):
3
  out = reg + " " + ''.join(chr(0xE0000 + ord(ch)) for ch in sec)
4
  return out
5
+ def decode_message(inp):
6
+ return ''.join(chr(ord(ch) - 0xE0000) if 0xE0000 <= ord(ch) <= 0x10FFFF else chr(ord(ch)) for ch in inp)
7
 
8
  with gr.Blocks() as app:
9
+ with gr.Tab("Hide"):
10
+ with gr.Row():
11
+ with gr.Column():
12
+ reg = gr.Textbox(label="Visible String")
13
+ sec = gr.Textbox(label="Secret Message")
14
+ btn=gr.Button("Hide")
15
+ outp=gr.Textbox(label="Output Message")
16
+ with gr.Tab("Decode"):
17
+ with gr.Row():
18
+ inp_mes=gr.Textbox(label="Hidden Message",lines=4)
19
+ dec_btn=gr.Button("Decode")
20
+ out_d=gr.Textbox(label="Decoded Message")
21
+ dec_btn.click(decode_message,inp_mes,out_d)
22
  btn.click(hide_message,[reg,sec],outp)
23
  app.launch()