Spaces:
Running
Running
Next
commited on
Commit
•
51915bc
1
Parent(s):
e678166
Update app.py
Browse files
app.py
CHANGED
@@ -92,12 +92,36 @@ def rsa_keys():
|
|
92 |
private_key, public_key = rsa_generate_keys()
|
93 |
return private_key, public_key
|
94 |
|
95 |
-
# Gradio interface
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
100 |
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
demo.launch()
|
|
|
92 |
private_key, public_key = rsa_generate_keys()
|
93 |
return private_key, public_key
|
94 |
|
95 |
+
# Gradio Blocks interface
|
96 |
+
with gr.Blocks() as demo:
|
97 |
+
with gr.Tab("Caesar Cipher"):
|
98 |
+
with gr.Row():
|
99 |
+
caesar_text = gr.Textbox(label="Text")
|
100 |
+
caesar_shift = gr.Number(label="Shift")
|
101 |
+
caesar_mode = gr.Radio(["Encrypt", "Decrypt"], label="Mode")
|
102 |
+
caesar_output = gr.Textbox(label="Output")
|
103 |
+
gr.Button("Submit").click(caesar_encrypt_decrypt, [caesar_text, caesar_shift, caesar_mode], caesar_output)
|
104 |
|
105 |
+
with gr.Tab("AES"):
|
106 |
+
with gr.Row():
|
107 |
+
aes_key = gr.Textbox(label="Key")
|
108 |
+
aes_text = gr.Textbox(label="Text")
|
109 |
+
aes_mode = gr.Radio(["Encrypt", "Decrypt"], label="Mode")
|
110 |
+
aes_output = gr.Textbox(label="Output")
|
111 |
+
gr.Button("Submit").click(aes_encrypt_decrypt, [aes_key, aes_text, aes_mode], aes_output)
|
112 |
+
|
113 |
+
with gr.Tab("RSA"):
|
114 |
+
with gr.Row():
|
115 |
+
rsa_key = gr.Textbox(label="Key (Public/Private)")
|
116 |
+
rsa_text = gr.Textbox(label="Text")
|
117 |
+
rsa_mode = gr.Radio(["Encrypt", "Decrypt"], label="Mode")
|
118 |
+
rsa_key_type = gr.Radio(["Public Key", "Private Key"], label="Key Type")
|
119 |
+
rsa_output = gr.Textbox(label="Output")
|
120 |
+
gr.Button("Submit").click(rsa_encrypt_decrypt, [rsa_key, rsa_text, rsa_mode, rsa_key_type], rsa_output)
|
121 |
+
|
122 |
+
with gr.Tab("RSA Key Generation"):
|
123 |
+
rsa_private_output = gr.Textbox(label="Private Key")
|
124 |
+
rsa_public_output = gr.Textbox(label="Public Key")
|
125 |
+
gr.Button("Generate Keys").click(rsa_keys, [], [rsa_private_output, rsa_public_output])
|
126 |
|
127 |
demo.launch()
|