Spaces:
Sleeping
Sleeping
Ahmad Hammoudeh
commited on
Commit
·
71efbd9
1
Parent(s):
b735b2e
Create Applc.py
Browse files
Applc.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
os.system('!pip install pycryptodome -q')
|
| 7 |
+
|
| 8 |
+
from datetime import datetime
|
| 9 |
+
import random
|
| 10 |
+
import math
|
| 11 |
+
import base64
|
| 12 |
+
import hashlib
|
| 13 |
+
from Crypto import Random
|
| 14 |
+
from Crypto.Cipher import AES
|
| 15 |
+
import rsa
|
| 16 |
+
import string
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
from msg_encX import *
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def Encrypt_users_txt(Txt):
|
| 23 |
+
encMessage = Encrypt_msg(User_message=Txt,user_password='',path='')
|
| 24 |
+
return encMessage
|
| 25 |
+
|
| 26 |
+
def Decrypt_users_txt(Txt,user_password):
|
| 27 |
+
#Txt = input_parameters[0]
|
| 28 |
+
#user_password = input_parameters[1]
|
| 29 |
+
encMessage = Decrypt_msg(encMessage=Txt,user_password='',path='')
|
| 30 |
+
return encMessage
|
| 31 |
+
|
| 32 |
+
#result_button_encrypt = gr.Button('Encrypt')
|
| 33 |
+
#result_button_encrypt.click(greet, inputs = "text", outputs = "text")
|
| 34 |
+
|
| 35 |
+
#iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 36 |
+
#iface.launch()
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
with gr.Blocks() as demo:
|
| 41 |
+
#gr.Markdown("<h1><center>Free Fast YouTube URL Video-to-Text using <a href=https://openai.com/blog/whisper/ target=_blank>OpenAI's Whisper</a> Model</center></h1>")
|
| 42 |
+
gr.Markdown("<center> Encrypt your message and use the same link to decrypt it on the same day.</center>")
|
| 43 |
+
gr.Markdown("<center> The one day limit is to enhance the privacy of the encrypted messages.</center>")
|
| 44 |
+
gr.Markdown("<center><b>'You can encrypt/decrypt so many messages everyday.'</b></center>")
|
| 45 |
+
#gr.Markdown("<center>Transcription takes 5-10 seconds per minute of the video (bad audio/hard accents slow it down a bit). #patience<br />If you have time while waiting, drop a ♥️ and check out my <a href=https://www.artificial-intelligence.blog target=_blank>AI blog</a> (opens in new tab).</center>")
|
| 46 |
+
input_text = gr.Textbox(placeholder='Message', label='Message')
|
| 47 |
+
#User_password = gr.Textbox(placeholder='Password', label='User password')
|
| 48 |
+
result_button_encrypt = gr.Button('Encrypt')
|
| 49 |
+
result_button_decrypt = gr.Button('Decrypt')
|
| 50 |
+
#vc_f0method = gr.Radio(label="Encrypt or Decrypt", choices=["Encrypt", "Decrypt"],value="Encrypt",interactive=True,)
|
| 51 |
+
output_text = gr.Textbox(placeholder='Output message', label='Encrypte')
|
| 52 |
+
|
| 53 |
+
result_button_encrypt.click(Encrypt_users_txt, inputs = input_text, outputs = output_text)
|
| 54 |
+
result_button_decrypt.click(Decrypt_users_txt, inputs = input_text, outputs = output_text)
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
demo.queue(default_enabled = True).launch(debug = True)
|