1_🎬_Home.py 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. Home Page - Main video generation interface
  14. """
  15. import sys
  16. from pathlib import Path
  17. # Add project root to sys.path
  18. _script_dir = Path(__file__).resolve().parent
  19. _project_root = _script_dir.parent.parent
  20. if str(_project_root) not in sys.path:
  21. sys.path.insert(0, str(_project_root))
  22. import streamlit as st
  23. # Import state management
  24. from web.state.session import init_session_state, init_i18n, get_pixelle_video
  25. # Import components
  26. from web.components.header import render_header
  27. from web.components.settings import render_advanced_settings
  28. from web.components.faq import render_faq_sidebar
  29. # Page config
  30. st.set_page_config(
  31. page_title="Home - Pixelle-Video",
  32. page_icon="🎬",
  33. layout="wide",
  34. initial_sidebar_state="collapsed",
  35. )
  36. def main():
  37. """Main UI entry point"""
  38. # Initialize session state and i18n
  39. init_session_state()
  40. init_i18n()
  41. # Render header (title + language selector)
  42. render_header()
  43. # Render FAQ in sidebar
  44. render_faq_sidebar()
  45. # Initialize Pixelle-Video
  46. pixelle_video = get_pixelle_video()
  47. # Render system configuration (LLM + ComfyUI)
  48. render_advanced_settings()
  49. # ========================================================================
  50. # Pipeline Selection & Delegation
  51. # ========================================================================
  52. from web.pipelines import get_all_pipeline_uis
  53. # Get all registered pipelines
  54. pipelines = get_all_pipeline_uis()
  55. # Use Tabs for pipeline selection
  56. # Note: st.tabs returns a list of containers, one for each tab
  57. tab_labels = [f"{p.icon} {p.display_name}" for p in pipelines]
  58. tabs = st.tabs(tab_labels)
  59. # Render each pipeline in its corresponding tab
  60. for i, pipeline in enumerate(pipelines):
  61. with tabs[i]:
  62. # Show description if available
  63. if pipeline.description:
  64. st.caption(pipeline.description)
  65. # Delegate rendering
  66. pipeline.render(pixelle_video)
  67. if __name__ == "__main__":
  68. main()