Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,7 +55,7 @@ def encrypt(passw=None,mes=None,img=None,doc=None):
|
|
| 55 |
# read all file data
|
| 56 |
#file_data = file.read()
|
| 57 |
enc_doc = fernet.encrypt(doc)
|
| 58 |
-
enc_file=
|
| 59 |
with open(enc_file, "wb") as file:
|
| 60 |
file.write(enc_doc)
|
| 61 |
|
|
@@ -117,6 +117,7 @@ with gr.Blocks() as app:
|
|
| 117 |
doc=gr.File(type="binary")
|
| 118 |
en_btn = gr.Button("Encrypt")
|
| 119 |
enc_out = gr.Textbox(label="Encrypted Bytes")
|
|
|
|
| 120 |
with gr.Tab("Decrypt"):
|
| 121 |
pass_out = gr.Textbox(label="Enter Password")
|
| 122 |
enc_in = gr.Textbox(label="Encrypted Bytes")
|
|
@@ -124,7 +125,7 @@ with gr.Blocks() as app:
|
|
| 124 |
d_txt = gr.Textbox(label="Decrypted")
|
| 125 |
d_im =gr.Image(label="Decrytped Image")
|
| 126 |
d_txt=gr.Textbox()
|
| 127 |
-
en_btn.click(encrypt,[pass_in,mes,im,doc],enc_out)
|
| 128 |
d_btn.click(decrypt,[pass_out,enc_in],[d_im,d_txt])
|
| 129 |
app.launch()
|
| 130 |
|
|
|
|
| 55 |
# read all file data
|
| 56 |
#file_data = file.read()
|
| 57 |
enc_doc = fernet.encrypt(doc)
|
| 58 |
+
enc_file='test.ocrpt'
|
| 59 |
with open(enc_file, "wb") as file:
|
| 60 |
file.write(enc_doc)
|
| 61 |
|
|
|
|
| 117 |
doc=gr.File(type="binary")
|
| 118 |
en_btn = gr.Button("Encrypt")
|
| 119 |
enc_out = gr.Textbox(label="Encrypted Bytes")
|
| 120 |
+
enc_doc_out=gr.File()
|
| 121 |
with gr.Tab("Decrypt"):
|
| 122 |
pass_out = gr.Textbox(label="Enter Password")
|
| 123 |
enc_in = gr.Textbox(label="Encrypted Bytes")
|
|
|
|
| 125 |
d_txt = gr.Textbox(label="Decrypted")
|
| 126 |
d_im =gr.Image(label="Decrytped Image")
|
| 127 |
d_txt=gr.Textbox()
|
| 128 |
+
en_btn.click(encrypt,[pass_in,mes,im,doc],[enc_out,enc_doc_out])
|
| 129 |
d_btn.click(decrypt,[pass_out,enc_in],[d_im,d_txt])
|
| 130 |
app.launch()
|
| 131 |
|