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