Spaces:
Paused
Paused
Download app/main.py from mrqadeer/email-classifier: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/mrqadeer/email-classifier/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/mrqadeer/email-classifier/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/mrqadeer/email-classifier/resolve/main/app/main.py
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 | |
| 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() | |