Spaces:
Sleeping
Sleeping
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() |