Assistant / app.py
Really-amin's picture
Upload 7 files
7da6612 verified
import streamlit as st
from admin_dashboard import AdminDashboard
from banking_assistant import BankingAssistant
from banking_model import BankingModelTrainer
from ml_banking_model import MLBankingEngine
class BankingSystem:
def __init__(self):
self.ml_engine = MLBankingEngine()
self.model_trainer = BankingModelTrainer()
self.assistant = BankingAssistant()
self.admin = AdminDashboard()
self.setup_page_config()
self.initialize_session_state()
def setup_page_config(self):
st.set_page_config(
page_title="سیستم بانکداری هوشمند",
page_icon="🏦",
layout="wide",
initial_sidebar_state="expanded"
)
def initialize_session_state(self):
if 'theme' not in st.session_state:
st.session_state.theme = 'light'
if 'user_role' not in st.session_state:
st.session_state.user_role = 'user'
if 'authenticated' not in st.session_state:
st.session_state.authenticated = False
def render_login(self):
st.markdown("""
<div style='text-align: center; padding: 50px;'>
<h1>🏦 سیستم بانکداری هوشمند</h1>
<p>لطفا وارد شوید</p>
</div>
""", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1,2,1])
with col2:
username = st.text_input("نام کاربری")
password = st.text_input("رمز عبور", type="password")
if st.button("ورود"):
if username == "admin" and password == "admin":
st.session_state.user_role = 'admin'
st.session_state.authenticated = True
st.experimental_rerun()
elif username and password:
st.session_state.user_role = 'user'
st.session_state.authenticated = True
st.experimental_rerun()
def render_header(self):
st.markdown("""
<div style='display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: white; box-shadow: 0 2px 4px rgba(0,0,0,0.1);'>
<h2>🏦 سیستم بانکداری هوشمند</h2>
<div>
<button onclick='logout()'>خروج</button>
</div>
</div>
""", unsafe_allow_html=True)
def main(self):
if not st.session_state.authenticated:
self.render_login()
else:
self.render_header()
if st.session_state.user_role == 'admin':
self.admin.render_dashboard()
else:
self.assistant.render_chat_interface()
if __name__ == "__main__":
system = BankingSystem()
system.main()