Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,23 @@
|
|
1 |
import gradio as gr
|
2 |
def hide_message(reg,sec):
|
3 |
out = reg + " " + ''.join(chr(0xE0000 + ord(ch)) for ch in sec)
|
4 |
-
#def reverse_e0000_encoding(input_str):
|
5 |
-
print(''.join(chr(ord(ch) - 0xE0000) if 0xE0000 <= ord(ch) <= 0x10FFFF else chr(ord(ch)) for ch in out))
|
6 |
-
print (len(out))
|
7 |
-
print (out)
|
8 |
-
print([out])
|
9 |
return out
|
10 |
-
|
|
|
11 |
|
12 |
with gr.Blocks() as app:
|
13 |
-
with gr.
|
14 |
-
with gr.
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
btn.click(hide_message,[reg,sec],outp)
|
20 |
app.launch()
|
|
|
1 |
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 |
+
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()
|