Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def create_key(passw):
|
|
38 |
return key
|
39 |
|
40 |
|
41 |
-
def encrypt(passw,
|
42 |
#key = Fernet.generate_key()
|
43 |
key = create_key(passw)
|
44 |
fernet = Fernet(key)
|
@@ -174,19 +174,14 @@ def decode_qr(im,passw):
|
|
174 |
with gr.Blocks() as app:
|
175 |
with gr.Tab("Encrypt"):
|
176 |
pass_in=gr.Textbox(label="Set Password")
|
177 |
-
with gr.
|
178 |
-
with gr.
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
with gr.Row():
|
186 |
-
im = gr.Image(type="filepath")
|
187 |
-
with gr.Tab("File"):
|
188 |
-
doc=gr.File()
|
189 |
-
enc_doc_out=gr.File()
|
190 |
en_btn = gr.Button("Encrypt")
|
191 |
enc_out = gr.Textbox(label="Encrypted Bytes")
|
192 |
enc_qr_out = gr.Image(label = "Encrypted QR")
|
@@ -197,11 +192,11 @@ with gr.Blocks() as app:
|
|
197 |
dec_qr_im = gr.Image(type="filepath")
|
198 |
with gr.Row():
|
199 |
dec_qr_txt = gr.Textbox(label="Decrypted Message")
|
200 |
-
d_json = gr.
|
201 |
|
202 |
dec_qr_im_out =gr.Image(label="Decrytped Image")
|
203 |
dec_qr_btn = gr.Button("Decrypt")
|
204 |
|
205 |
dec_qr_btn.click(decode_qr,[dec_qr_im,pass_out],[dec_qr_im_out,dec_qr_txt,d_json])
|
206 |
-
en_btn.click(encrypt,[pass_in,
|
207 |
app.launch()
|
|
|
38 |
return key
|
39 |
|
40 |
|
41 |
+
def encrypt(passw,trans_s=None,trans_r=None,trans_a=None):
|
42 |
#key = Fernet.generate_key()
|
43 |
key = create_key(passw)
|
44 |
fernet = Fernet(key)
|
|
|
174 |
with gr.Blocks() as app:
|
175 |
with gr.Tab("Encrypt"):
|
176 |
pass_in=gr.Textbox(label="Set Password")
|
177 |
+
with gr.Row():
|
178 |
+
with gr.Column():
|
179 |
+
send=gr.Textbox(label="Sender")
|
180 |
+
rec=gr.Textbox(label="Recipient")
|
181 |
+
am=gr.Textbox(label="Amount")
|
182 |
+
gr.Column()
|
183 |
+
|
184 |
+
|
|
|
|
|
|
|
|
|
|
|
185 |
en_btn = gr.Button("Encrypt")
|
186 |
enc_out = gr.Textbox(label="Encrypted Bytes")
|
187 |
enc_qr_out = gr.Image(label = "Encrypted QR")
|
|
|
192 |
dec_qr_im = gr.Image(type="filepath")
|
193 |
with gr.Row():
|
194 |
dec_qr_txt = gr.Textbox(label="Decrypted Message")
|
195 |
+
d_json = gr.JSON(label="Decrypted JSON")
|
196 |
|
197 |
dec_qr_im_out =gr.Image(label="Decrytped Image")
|
198 |
dec_qr_btn = gr.Button("Decrypt")
|
199 |
|
200 |
dec_qr_btn.click(decode_qr,[dec_qr_im,pass_out],[dec_qr_im_out,dec_qr_txt,d_json])
|
201 |
+
en_btn.click(encrypt,[pass_in,send,rec,am],[enc_out,enc_qr_out,dec_qr_im])
|
202 |
app.launch()
|