Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,49 +1,59 @@
|
|
1 |
import gradio as gr
|
2 |
import crypt
|
|
|
3 |
rec_list = []
|
|
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
7 |
|
8 |
with gr.Blocks() as app:
|
9 |
-
with gr.
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
with gr.Row():
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
with gr.
|
16 |
-
with gr.
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
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(crypt.test_fn,[img1,img3],[input_key,input_address])
|
|
|
1 |
import gradio as gr
|
2 |
import crypt
|
3 |
+
import os
|
4 |
rec_list = []
|
5 |
+
pa=os.environ['PASS']
|
6 |
|
7 |
+
def checkp(inp):
|
8 |
+
if inp == pa:
|
9 |
+
return gr.update(visible=False), gr.update(visible=True)
|
10 |
+
elif inp != pa:
|
11 |
+
return gr.update(visible=True), gr.update(visible=False)
|
12 |
|
13 |
with gr.Blocks() as app:
|
14 |
+
with gr.Row(visible=True) as invalid:
|
15 |
+
pass_box = gr.Textbox()
|
16 |
+
pass_btn = gr.Button()
|
17 |
+
|
18 |
+
with gr.Box(visible=False) as valida:
|
19 |
+
with gr.Tab("Messages"):
|
20 |
+
with gr.Accordion("Key"):
|
21 |
+
with gr.Row():
|
22 |
+
input_address = gr.Image(label="Wallet",type="filepath")
|
23 |
+
input_key = gr.Image(label="Key",type="filepath")
|
24 |
+
|
25 |
with gr.Row():
|
26 |
+
with gr.Column():
|
27 |
+
rec=gr.Dropdown(label="Recipient", choices=[f for f in rec_list], allow_custom_value=True)
|
28 |
+
send_mes=gr.Textbox(label="Message", lines=6)
|
29 |
+
send_mes_btn=gr.Button()
|
30 |
+
rec_mes = gr.Textbox(lines=6)
|
31 |
+
|
32 |
+
|
33 |
|
34 |
+
with gr.Tab("BC"):
|
35 |
+
with gr.Row():
|
36 |
+
with gr.Tab("Gen Wal"):
|
37 |
+
gen_wal_btn=gr.Button()
|
38 |
+
seed = gr.Textbox(label='Seed Phrase')
|
39 |
+
img1=gr.Pil(label='Private Key')
|
40 |
+
out1 = gr.Textbox(label='Private Key',max_lines=4)
|
41 |
+
img2=gr.Pil(label='Public Key')
|
42 |
+
out2 = gr.Textbox(label='Public Key',max_lines=4)
|
43 |
+
img3=gr.Pil(label='Address')
|
44 |
+
out3 = gr.Textbox(label='Address')
|
45 |
+
with gr.Tab("Encrypt"):
|
46 |
+
rsa_to_enc = gr.Textbox(label="txt to encrypt")
|
47 |
+
pub_key_in = gr.Image(label="Public Key", type="filepath")
|
48 |
+
priv_key_in1 = gr.Image(label="Private Key(sig)", type="filepath")
|
49 |
+
rsa_enc_btn = gr.Button("RSA Encrypt")
|
50 |
+
rsa_enc_mes = gr.Textbox(label="encoded", max_lines=4)
|
51 |
+
qr_enc_mes = gr.Image(type="filepath")
|
52 |
+
with gr.Tab("Decrypt"):
|
53 |
+
mes_in = gr.Image(label="Message", type="filepath")
|
54 |
+
priv_key_in = gr.Image(label="Private Key", type="filepath")
|
55 |
+
rsa_dec_btn = gr.Button("RSA Decrypt")
|
56 |
+
rsa_dec_mes = gr.Textbox(label="decoded")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
|
59 |
gen_wal_btn.click(crypt.generate_keys,None,[out2,out1,img3,out3,img1,img2]).then(crypt.test_fn,[img1,img3],[input_key,input_address])
|