Omnibus commited on
Commit
d9650af
·
1 Parent(s): 2e0a505

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -38
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.Tab("Messages"):
10
- with gr.Accordion("Key"):
 
 
 
 
 
 
 
 
 
11
  with gr.Row():
12
- input_address = gr.Image(label="Wallet",type="filepath")
13
- input_key = gr.Image(label="Key",type="filepath")
 
 
 
 
 
14
 
15
- with gr.Row():
16
- with gr.Column():
17
- rec=gr.Dropdown(label="Recipient", choices=[f for f in rec_list], allow_custom_value=True)
18
- send_mes=gr.Textbox(label="Message", lines=6)
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(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])