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