standard.py 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. Standard Pipeline UI
  14. Implements the classic 3-column layout for the Standard Pipeline.
  15. """
  16. import streamlit as st
  17. from typing import Any
  18. from web.i18n import tr
  19. from web.pipelines.base import PipelineUI, register_pipeline_ui
  20. # Import components
  21. from web.components.content_input import render_content_input, render_bgm_section, render_version_info
  22. from web.components.style_config import render_style_config
  23. from web.components.output_preview import render_output_preview
  24. class StandardPipelineUI(PipelineUI):
  25. """
  26. UI for the Standard Video Generation Pipeline.
  27. Implements the classic 3-column layout.
  28. """
  29. name = "quick_create"
  30. icon = "⚡"
  31. @property
  32. def display_name(self):
  33. return tr("pipeline.quick_create.name")
  34. @property
  35. def description(self):
  36. return tr("pipeline.quick_create.description")
  37. def render(self, pixelle_video: Any):
  38. # Three-column layout
  39. left_col, middle_col, right_col = st.columns([1, 1, 1])
  40. # ====================================================================
  41. # Left Column: Content Input & BGM
  42. # ====================================================================
  43. with left_col:
  44. # Content input (mode, text, title, n_scenes)
  45. content_params = render_content_input()
  46. # BGM selection (bgm_path, bgm_volume)
  47. bgm_params = render_bgm_section()
  48. # Version info & GitHub link
  49. render_version_info()
  50. # ====================================================================
  51. # Middle Column: Style Configuration
  52. # ====================================================================
  53. with middle_col:
  54. # Style configuration (TTS, template, workflow, etc.)
  55. style_params = render_style_config(pixelle_video)
  56. # ====================================================================
  57. # Right Column: Output Preview
  58. # ====================================================================
  59. with right_col:
  60. # Combine all parameters
  61. video_params = {
  62. "pipeline": self.name,
  63. **content_params,
  64. **bgm_params,
  65. **style_params
  66. }
  67. # Render output preview (generate button, progress, video preview)
  68. render_output_preview(pixelle_video, video_params)
  69. # Register self
  70. register_pipeline_ui(StandardPipelineUI)