Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import codecs
|
3 |
+
|
4 |
+
def rot13_cipher(text):
|
5 |
+
# Encode the text using ROT13
|
6 |
+
rot13_encoded = codecs.encode(text, 'rot_13')
|
7 |
+
|
8 |
+
# Decode the text using ROT13
|
9 |
+
rot13_decoded = codecs.decode(rot13_encoded, 'rot_13')
|
10 |
+
|
11 |
+
return rot13_encoded, rot13_decoded
|
12 |
+
|
13 |
+
# Gradio interface
|
14 |
+
iface = gr.Interface(
|
15 |
+
fn=rot13_cipher,
|
16 |
+
inputs="text",
|
17 |
+
outputs=["text", "text"],
|
18 |
+
title="ROT13 Encoder/Decoder",
|
19 |
+
description="Enter text to see its ROT13 encoded and decoded versions."
|
20 |
+
)
|
21 |
+
|
22 |
+
# Launch the interface
|
23 |
+
iface.launch()
|