| 1 | # Copyright (C) 2025 AIDC-AI |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | # See the License for the specific language governing permissions and |
| 11 | # limitations under the License. |
| 12 | |
| 13 | """ |
| 14 | Pixelle-Video Web UI - Main Entry Point |
| 15 | |
| 16 | This is the entry point for the Streamlit multi-page application. |
| 17 | Uses st.navigation to define pages and set the default page to Home. |
| 18 | """ |
| 19 | |
| 20 | import sys |
| 21 | from pathlib import Path |
| 22 | |
| 23 | # Add project root to sys.path for module imports |
| 24 | _script_dir = Path(__file__).resolve().parent |
| 25 | _project_root = _script_dir.parent |
| 26 | if str(_project_root) not in sys.path: |
| 27 | sys.path.insert(0, str(_project_root)) |
| 28 | |
| 29 | import streamlit as st |
| 30 | |
| 31 | # Setup page config (must be first Streamlit command) |
| 32 | st.set_page_config( |
| 33 | page_title="Pixelle-Video - AI Video Generator", |
| 34 | page_icon="🎬", |
| 35 | layout="wide", |
| 36 | initial_sidebar_state="collapsed", |
| 37 | ) |
| 38 | |
| 39 | |
| 40 | def main(): |
| 41 | """Main entry point with navigation""" |
| 42 | # Define pages using st.Page |
| 43 | home_page = st.Page( |
| 44 | "pages/1_🎬_Home.py", |
| 45 | title="Home", |
| 46 | icon="🎬", |
| 47 | default=True |
| 48 | ) |
| 49 | |
| 50 | history_page = st.Page( |
| 51 | "pages/2_📚_History.py", |
| 52 | title="History", |
| 53 | icon="📚" |
| 54 | ) |
| 55 | |
| 56 | # Set up navigation and run |
| 57 | pg = st.navigation([home_page, history_page]) |
| 58 | pg.run() |
| 59 | |
| 60 | |
| 61 | if __name__ == "__main__": |
| 62 | main() |
| 63 |