Ahmad Hammoudeh
Update App.py
a1813e4
raw
history blame
2.32 kB
import gradio as gr
import os
os.system('!pip install pycryptodome -q')
from datetime import datetime
import random
import math
import base64
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
import rsa
import string
from msg_encX import *
def Encrypt_users_txt(Txt):
encMessage = Encrypt_msg(User_message=Txt,user_password='',path='')
return encMessage
def Decrypt_users_txt(Txt,user_password):
#Txt = input_parameters[0]
#user_password = input_parameters[1]
encMessage = Decrypt_msg(encMessage=Txt,user_password='',path='')
return encMessage
#result_button_encrypt = gr.Button('Encrypt')
#result_button_encrypt.click(greet, inputs = "text", outputs = "text")
#iface = gr.Interface(fn=greet, inputs="text", outputs="text")
#iface.launch()
with gr.Blocks() as demo:
#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>")
gr.Markdown("<center> Encrypt your message and use the same link to decrypt it on the same day.</center>")
gr.Markdown("<center> The one day limit is to enhance the privacy of the encrypted messages.</center>")
gr.Markdown("<center><b>'You can encrypt/decrypt so many messages everyday.'</b></center>")
#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>")
input_text = gr.Textbox(placeholder='Message', label='Message')
#User_password = gr.Textbox(placeholder='Password', label='User password')
result_button_encrypt = gr.Button('Encrypt')
result_button_decrypt = gr.Button('Decrypt')
#vc_f0method = gr.Radio(label="Encrypt or Decrypt", choices=["Encrypt", "Decrypt"],value="Encrypt",interactive=True,)
output_text = gr.Textbox(placeholder='Output message', label='Encrypte')
result_button_encrypt.click(Encrypt_users_txt, inputs = input_text, outputs = output_text)
result_button_decrypt.click(Decrypt_users_txt, inputs = input_text, outputs = output_text)
demo.queue(default_enabled = True).launch(debug = True)