ai-assistant / main.py
digitalai's picture
Update main.py
b2bb2d8 verified
raw
history blame contribute delete
No virus
1.39 kB
from time import sleep
import streamlit as st
from arabic_support import support_arabic_text
from pathlib import Path
from navigation import make_sidebar
support_arabic_text(all=True)
# مسیر فایل فعلی
current_file_path = Path(__file__).resolve()
# مسیر ریشه پروژه (دو سطح بالاتر از فایل فعلی)
project_root = current_file_path.parents[0]
# مسیرهای دایرکتوری‌ها
assets_dir = project_root / "asset"
styles_dir = project_root / "styles"
pages = project_root / "pages"
# خواندن فایل CSS
css_file_path = styles_dir / "main.css"
with open(css_file_path, "r", encoding="utf-8") as file:
css_code = file.read()
# اعمال CSS
st.markdown(f"""
<head>
<style>
{css_code}
</style>
</head>
""", unsafe_allow_html=True)
state = st.session_state
make_sidebar()
st.title("Welcome to AI-Medical Questionnaire")
st.write("Please log in to continue (username `admin`, password `admin`).")
username = st.text_input("Username")
password = st.text_input("Password", type="password")
if st.button("Log in", type="primary"):
if username == "admin" and password == "admin":
state.logged_in = True
st.success("Logged in successfully!")
# sleep(0.5)
st.switch_page(str(pages / "1_app.py"))
else:
st.error("Incorrect username or password")