email-classifier / app /main.py
mrqadeer's picture
Initial project commit with code and figures
f6ea7de
Raw History Blame Contribute Delete
1.09 kB
import streamlit as st
from typing import Dict, Any, Callable
from app.api_client import APIClient
from app.config import AppConfig
from app.utils.ui_elements import load_css
# Initialize configuration
config = AppConfig()
# Page configuration
st.set_page_config(
page_title=config.APP_NAME,
page_icon="📧",
layout="wide",
initial_sidebar_state="expanded"
)
# Load custom CSS
load_css()
# Initialize API client
@st.cache_resource
def get_api_client() -> APIClient:
"""Create and cache the API client instance.
Returns:
Initialized API client
"""
return APIClient(base_url=config.API_BASE_URL)
api_client = get_api_client()
# Define pages with their metadata
home_page = st.Page(
page="views/home.py",
title="Home",
icon="🏠",
)
predictor_page = st.Page(
page="views/predictor.py",
title="Predictor",
icon="📧",
)
# Set up navigation
pages = st.navigation(
{
"Home": [home_page],
"Predictor": [predictor_page],
}
)
# Run the selected page
if __name__ == "__main__":
pages.run()