import gradio as gr from cryptography.fernet import Fernet # Generate a key and instantiate a Fernet instance key = Fernet.generate_key() cipher_suite = Fernet(key) def encrypt_string(input_string): encrypted_text = cipher_suite.encrypt(input_string.encode()) return encrypted_text.decode() # Create the Gradio interface iface = gr.Interface( fn=encrypt_string, inputs=gr.Textbox(lines=2, placeholder="Enter a string to encrypt..."), outputs="text", title="AES Encryption with Fernet", description="Enter a string to encrypt it using AES encryption with Fernet." ) # Launch the interface iface.launch()