Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,51 +17,55 @@ with gr.Blocks() as app:
|
|
17 |
pass_box = gr.Textbox()
|
18 |
pass_btn = gr.Button()
|
19 |
|
20 |
-
with gr.Box(visible=False) as valida:
|
21 |
-
|
22 |
-
|
23 |
-
with gr.Row():
|
24 |
-
input_address = gr.Image(label="Wallet",type="filepath")
|
25 |
-
input_key = gr.Image(label="Key",type="filepath")
|
26 |
-
|
27 |
with gr.Row():
|
28 |
-
with gr.
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
with gr.Tab("BC"):
|
37 |
-
with gr.Row():
|
38 |
-
with gr.Tab("Gen Wal"):
|
39 |
-
gen_wal_btn=gr.Button()
|
40 |
-
seed = gr.Textbox(label='Seed Phrase')
|
41 |
-
img1=gr.Pil(label='Private Key')
|
42 |
-
out1 = gr.Textbox(label='Private Key',max_lines=4)
|
43 |
-
img2=gr.Pil(label='Public Key')
|
44 |
-
out2 = gr.Textbox(label='Public Key',max_lines=4)
|
45 |
-
img3=gr.Pil(label='Address')
|
46 |
-
out3 = gr.Textbox(label='Address')
|
47 |
-
with gr.Tab("Encrypt"):
|
48 |
-
rsa_to_enc = gr.Textbox(label="txt to encrypt")
|
49 |
-
pub_key_in = gr.Image(label="Public Key", type="filepath")
|
50 |
-
priv_key_in1 = gr.Image(label="Private Key(sig)", type="filepath")
|
51 |
-
rsa_enc_btn = gr.Button("RSA Encrypt")
|
52 |
-
rsa_enc_mes = gr.Textbox(label="encoded", max_lines=4)
|
53 |
-
qr_enc_mes = gr.Image(type="filepath")
|
54 |
-
with gr.Tab("Decrypt"):
|
55 |
-
mes_in = gr.Image(label="Message", type="filepath")
|
56 |
-
priv_key_in = gr.Image(label="Private Key", type="filepath")
|
57 |
-
rsa_dec_btn = gr.Button("RSA Decrypt")
|
58 |
-
rsa_dec_mes = gr.Textbox(label="decoded")
|
59 |
-
|
60 |
input_key.change(crypt.address,input_key,None)
|
61 |
|
62 |
pass_btn.click(checkp,pass_box,[invalid,valida])
|
63 |
|
64 |
-
gen_wal_btn.click(crypt.generate_keys,None,[out2,out1,img3,out3,img1,img2]).then(
|
65 |
rsa_enc_btn.click(crypt.encrypt_text,[rsa_to_enc,pub_key_in,priv_key_in1,out3],[rsa_enc_mes,qr_enc_mes])
|
66 |
rsa_dec_btn.click(crypt.decrypt_text,[mes_in,priv_key_in],rsa_dec_mes)
|
67 |
|
|
|
17 |
pass_box = gr.Textbox()
|
18 |
pass_btn = gr.Button()
|
19 |
|
20 |
+
with gr.Box(visible=False) as valida:
|
21 |
+
gr.Column()
|
22 |
+
with gr.Column():
|
|
|
|
|
|
|
|
|
23 |
with gr.Row():
|
24 |
+
with gr.Tab("Messages"):
|
25 |
+
with gr.Accordion("Key"):
|
26 |
+
input_key = gr.Image(label="Key",type="filepath")
|
27 |
+
|
28 |
+
with gr.Row():
|
29 |
+
with gr.Column():
|
30 |
+
rec=gr.Dropdown(label="Recipient", choices=[f for f in rec_list], allow_custom_value=True)
|
31 |
+
send_mes=gr.Textbox(label="Message", lines=6)
|
32 |
+
send_mes_btn=gr.Button()
|
33 |
+
rec_mes = gr.Textbox(lines=6)
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
with gr.Tab("BC"):
|
38 |
+
with gr.Row():
|
39 |
+
with gr.Tab("Gen Wal"):
|
40 |
+
gen_wal_btn=gr.Button()
|
41 |
+
seed = gr.Textbox(label='Seed Phrase')
|
42 |
+
img1=gr.Pil(label='Private Key')
|
43 |
+
out1 = gr.Textbox(label='Private Key',max_lines=4)
|
44 |
+
img2=gr.Pil(label='Public Key')
|
45 |
+
out2 = gr.Textbox(label='Public Key',max_lines=4)
|
46 |
+
img3=gr.Pil(label='Address')
|
47 |
+
out3 = gr.Textbox(label='Address')
|
48 |
+
with gr.Tab("Encrypt"):
|
49 |
+
rsa_to_enc = gr.Textbox(label="txt to encrypt")
|
50 |
+
pub_key_in = gr.Image(label="Public Key", type="filepath")
|
51 |
+
priv_key_in1 = gr.Image(label="Private Key(sig)", type="filepath")
|
52 |
+
rsa_enc_btn = gr.Button("RSA Encrypt")
|
53 |
+
rsa_enc_mes = gr.Textbox(label="encoded", max_lines=4)
|
54 |
+
qr_enc_mes = gr.Image(type="filepath")
|
55 |
+
with gr.Tab("Decrypt"):
|
56 |
+
mes_in = gr.Image(label="Message", type="filepath")
|
57 |
+
priv_key_in = gr.Image(label="Private Key", type="filepath")
|
58 |
+
rsa_dec_btn = gr.Button("RSA Decrypt")
|
59 |
+
rsa_dec_mes = gr.Textbox(label="decoded")
|
60 |
+
gr.Column()
|
61 |
+
def test_fn(im):
|
62 |
+
return (im)
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
input_key.change(crypt.address,input_key,None)
|
65 |
|
66 |
pass_btn.click(checkp,pass_box,[invalid,valida])
|
67 |
|
68 |
+
gen_wal_btn.click(crypt.generate_keys,None,[out2,out1,img3,out3,img1,img2]).then(test_fn,[img1],[input_key])
|
69 |
rsa_enc_btn.click(crypt.encrypt_text,[rsa_to_enc,pub_key_in,priv_key_in1,out3],[rsa_enc_mes,qr_enc_mes])
|
70 |
rsa_dec_btn.click(crypt.decrypt_text,[mes_in,priv_key_in],rsa_dec_mes)
|
71 |
|