# app.py import streamlit as st # Set page configuration st.set_page_config( page_title='💵 Currency Converter', page_icon='💱', layout='centered' ) # App Header st.markdown( """

💵 Currency Converter

Easily convert currencies offline with predefined rates

""", unsafe_allow_html=True ) # Predefined Exchange Rates (Static Data) EXCHANGE_RATES = { "USD": {"EUR": 0.85, "GBP": 0.75, "PKR": 280.0}, "EUR": {"USD": 1.18, "GBP": 0.88, "PKR": 330.0}, "GBP": {"USD": 1.33, "EUR": 1.14, "PKR": 380.0}, "PKR": {"USD": 0.0036, "EUR": 0.0030, "GBP": 0.0026} } # Currency Selection col1, col2 = st.columns(2) with col1: from_currency = st.selectbox('🔄 Select Base Currency:', list(EXCHANGE_RATES.keys())) with col2: to_currency = st.selectbox('🔄 Select Target Currency:', list(EXCHANGE_RATES.keys())) # Amount Input amount = st.number_input('💰 Enter Amount:', min_value=0.0, format='%.2f') # Convert Button if st.button('🔄 Convert'): if from_currency == to_currency: st.warning("⚠️ Base and target currencies are the same. Please select different currencies.") else: try: rate = EXCHANGE_RATES[from_currency][to_currency] result = amount * rate st.success(f'✅ {amount} {from_currency} = {result:.2f} {to_currency}') except KeyError: st.error("❌ Conversion rate not available for selected currencies.") # Footer st.markdown( """

💻 Developed by ChatGPT

""", unsafe_allow_html=True )