Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
rec_list = []
|
4 |
|
5 |
|
@@ -19,4 +19,35 @@ with gr.Blocks() as app:
|
|
19 |
send_mes_btn=gr.Button()
|
20 |
rec_mes = gr.Textbox(lines=6)
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
app.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import crypt
|
3 |
rec_list = []
|
4 |
|
5 |
|
|
|
19 |
send_mes_btn=gr.Button()
|
20 |
rec_mes = gr.Textbox(lines=6)
|
21 |
|
22 |
+
|
23 |
+
|
24 |
+
with gr.Tab("BC"):
|
25 |
+
with gr.Row():
|
26 |
+
with gr.Tab("Gen Wal"):
|
27 |
+
gen_wal_btn=gr.Button()
|
28 |
+
seed = gr.Textbox(label='Seed Phrase')
|
29 |
+
img1=gr.Pil(label='Private Key')
|
30 |
+
out1 = gr.Textbox(label='Private Key',max_lines=4)
|
31 |
+
img2=gr.Pil(label='Public Key')
|
32 |
+
out2 = gr.Textbox(label='Public Key',max_lines=4)
|
33 |
+
img3=gr.Pil(label='Address')
|
34 |
+
out3 = gr.Textbox(label='Address')
|
35 |
+
with gr.Tab("Encrypt"):
|
36 |
+
rsa_to_enc = gr.Textbox(label="txt to encrypt")
|
37 |
+
pub_key_in = gr.Image(label="Public Key", type="filepath")
|
38 |
+
priv_key_in1 = gr.Image(label="Private Key(sig)", type="filepath")
|
39 |
+
rsa_enc_btn = gr.Button("RSA Encrypt")
|
40 |
+
rsa_enc_mes = gr.Textbox(label="encoded", max_lines=4)
|
41 |
+
qr_enc_mes = gr.Image(type="filepath")
|
42 |
+
with gr.Tab("Decrypt"):
|
43 |
+
mes_in = gr.Image(label="Message", type="filepath")
|
44 |
+
priv_key_in = gr.Image(label="Private Key", type="filepath")
|
45 |
+
rsa_dec_btn = gr.Button("RSA Decrypt")
|
46 |
+
rsa_dec_mes = gr.Textbox(label="decoded")
|
47 |
+
|
48 |
+
|
49 |
+
gen_wal_btn.click(crypt.generate_keys,None,[out2,out1, img3,out3,img1,img2]).then(create_new_chain,out3,[json_out,block_text,send,rec]).then(crypt.test_fn,[img1,img2],[priv_key_in,pub_key_in,priv_key_in1])
|
50 |
+
rsa_enc_btn.click(crypt.encrypt_text,[rsa_to_enc,pub_key_in,priv_key_in1,out3],[rsa_enc_mes,qr_enc_mes]).then(crypt.test_fn2,qr_enc_mes,mes_in)
|
51 |
+
rsa_dec_btn.click(crypt.decrypt_text,[mes_in,priv_key_in],rsa_dec_mes)
|
52 |
+
|
53 |
app.launch()
|