File size: 622 Bytes
18298e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import codecs
import base64

def decode(text, method):
    if method == "ROT13":
        return codecs.encode(text, "rot_13")
    elif method == "Base64":
        try:
            return base64.b64decode(text).decode()
        except Exception:
            return "Couldn't decode — is that really Base64?"
    elif method == "Reverse":
        return text[::-1]

demo = gr.Interface(
    fn=decode,
    inputs=[gr.Textbox(label="Secret message"), gr.Radio(["ROT13", "Base64", "Reverse"], label="Method")],
    outputs=gr.Textbox(label="Decoded"),
    title="🕵️ Secret Decoder",
)
demo.launch()