app.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. Pixelle-Video Web UI - Main Entry Point
  14. This is the entry point for the Streamlit multi-page application.
  15. Uses st.navigation to define pages and set the default page to Home.
  16. """
  17. import sys
  18. from pathlib import Path
  19. # Add project root to sys.path for module imports
  20. _script_dir = Path(__file__).resolve().parent
  21. _project_root = _script_dir.parent
  22. if str(_project_root) not in sys.path:
  23. sys.path.insert(0, str(_project_root))
  24. import streamlit as st
  25. # Setup page config (must be first Streamlit command)
  26. st.set_page_config(
  27. page_title="Pixelle-Video - AI Video Generator",
  28. page_icon="🎬",
  29. layout="wide",
  30. initial_sidebar_state="collapsed",
  31. )
  32. def main():
  33. """Main entry point with navigation"""
  34. # Define pages using st.Page
  35. home_page = st.Page(
  36. "pages/1_🎬_Home.py",
  37. title="Home",
  38. icon="🎬",
  39. default=True
  40. )
  41. history_page = st.Page(
  42. "pages/2_📚_History.py",
  43. title="History",
  44. icon="📚"
  45. )
  46. # Set up navigation and run
  47. pg = st.navigation([home_page, history_page])
  48. pg.run()
  49. if __name__ == "__main__":
  50. main()