# save this file as app.py import streamlit as st import ast import pyperclip as pyp class encdec: def __init__(self, name): self.name = name self.enc = name def encode(self): enc = [] new_name = list(self.name) for ch in new_name: enc.append(ord(ch) + 7) self.enc = enc return enc def decode(self, enc): dec = [] for ch1 in self.enc: val = ch1 dec.append(chr(val - 7)) return ''.join(dec) # Streamlit UI st.title("Text Encoder / Decoder") choice = st.radio("Select Action:", ("Encode", "Decode")) if choice == "Encode": user_input = st.text_input("Enter text to encode:") if st.button("Encode"): obj = encdec(user_input) encoded = obj.encode() st.success(f"Encoded: {encoded}") pyp.copy(str(encoded)) # copy encoded list to clipboard st.info("Encoded value copied to clipboard!") elif choice == "Decode": password = st.text_input("Enter password for decoding:", type="password") if password: if password == "notgood": user_input = st.text_input("Enter text to decode (e.g., [118, 116]):") if st.button("Decode"): try: user_input1 = ast.literal_eval(user_input) obj = encdec(user_input1) decoded = obj.decode(user_input1) st.success(f"Decoded: {decoded}") pyp.copy(decoded) # copy decoded text to clipboard st.info("Decoded value copied to clipboard!") except: st.error("Invalid input! Enter a valid list like [118, 116].") else: st.error("Incorrect password! Access denied.")