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