| import gradio as gr | |
| import codecs | |
| def rot13_cipher(text): | |
| # Encode the text using ROT13 | |
| rot13_encoded = codecs.encode(text, 'rot_13') | |
| # Decode the text using ROT13 | |
| rot13_decoded = codecs.decode(rot13_encoded, 'rot_13') | |
| return rot13_encoded, rot13_encoded | |
| # Gradio interface | |
| iface = gr.Interface( | |
| fn=rot13_cipher, | |
| inputs="text", | |
| outputs=["text", "text"], | |
| title="ROT13 Encoder/Decoder", | |
| description="Enter text to see its ROT13 encoded and decoded versions." | |
| ) | |
| # Launch the interface | |
| iface.launch() | |