Aduc-sdr commited on
Commit
da7029e
verified
1 Parent(s): ce491b7

Delete aduc_orchestrator.1py

Browse files
Files changed (1) hide show
  1. aduc_orchestrator.1py +0 -178
aduc_orchestrator.1py DELETED
@@ -1,178 +0,0 @@
1
- # aduc_orchestrator.py
2
- #
3
- # AducSdr: Uma implementa莽茫o aberta e funcional da arquitetura ADUC-SDR
4
- # Copyright (C) 4 de Agosto de 2025 Carlos Rodrigues dos Santos
5
- #
6
- # Contato:
7
- # Carlos Rodrigues dos Santos
8
- # carlex22@gmail.com
9
- # Rua Eduardo Carlos Pereira, 4125, B1 Ap32, Curitiba, PR, Brazil, CEP 8102025
10
- #
11
- # Reposit贸rios e Projetos Relacionados:
12
- # GitHub: https://github.com/carlex22/Aduc-sdr
13
- #
14
- # This program is free software: you can redistribute it and/or modify
15
- # it under the terms of the GNU Affero General Public License as published by
16
- # the Free Software Foundation, either version 3 of the License, or
17
- # (at your option) any later version.
18
- #
19
- # This program is distributed in the hope that it will be useful,
20
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- # GNU Affero General Public License for more details.
23
- #
24
- # You should have received a copy of the GNU Affero General Public License
25
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
26
- #
27
- # This program is free software: you can redistribute it and/or modify
28
- # it under the terms of the GNU Affero General Public License...
29
- # PENDING PATENT NOTICE: Please see NOTICE.md.
30
- #
31
- # Version: 3.0.0
32
- #
33
- # This version adapts the Maestro to command the new unified "Turbo Intergalactic
34
- # Multiverse Engine": the Deformes7DEngine. The orchestrator is now a lean
35
- # command layer, delegating all complex production and post-production tasks
36
- # to its single, powerful Chief Engineer.
37
-
38
- import os
39
- import logging
40
- from typing import List, Dict, Any, Generator, Tuple
41
-
42
- import gradio as gr
43
- from PIL import Image, ImageOps
44
-
45
- # O Orquestrador agora s贸 precisa de dois engenheiros:
46
- # - O Pensador (2D) para a l贸gica criativa
47
- # - O Engenheiro-Chefe (7D) para toda a execu莽茫o
48
- from engineers.deformes2D_thinker import deformes2d_thinker_singleton
49
- from engineers.deformes7D import deformes7d_engine_singleton
50
-
51
- logger = logging.getLogger(__name__)
52
-
53
- class AducDirector:
54
- """
55
- Representa o Diretor de Cena, gerenciando o estado da produ莽茫o.
56
- """
57
- def __init__(self, workspace_dir: str):
58
- self.workspace_dir = workspace_dir
59
- os.makedirs(self.workspace_dir, exist_ok=True)
60
- self.state: Dict[str, Any] = {}
61
- logger.info(f"The stage is set. Workspace at '{self.workspace_dir}'.")
62
-
63
- def update_state(self, key: str, value: Any) -> None:
64
- logger.info(f"Notating on the score: State '{key}' updated.")
65
- self.state[key] = value
66
-
67
- def get_state(self, key: str, default: Any = None) -> Any:
68
- return self.state.get(key, default)
69
-
70
- class AducOrchestrator:
71
- """
72
- Implementa o Maestro (螕), a camada de orquestra莽茫o que comanda
73
- o Engenheiro-Chefe Deformes7D.
74
- """
75
- def __init__(self, workspace_dir: str):
76
- """
77
- Inicializa o Maestro e seu Engenheiro-Chefe.
78
- """
79
- self.director = AducDirector(workspace_dir)
80
- self.thinker = deformes2d_thinker_singleton
81
- self.chief_engineer = deformes7d_engine_singleton
82
- logger.info("ADUC Maestro is on the podium with the Chief Engineer (Deformes7D) ready.")
83
-
84
- def process_image_for_story(self, image_path: str, size: int, filename: str) -> str:
85
- """
86
- Pr茅-processa uma imagem de refer锚ncia, padronizando-a.
87
- """
88
- img = Image.open(image_path).convert("RGB")
89
- img_square = ImageOps.fit(img, (size, size), Image.Resampling.LANCZOS)
90
- processed_path = os.path.join(self.director.workspace_dir, filename)
91
- img_square.save(processed_path)
92
- logger.info(f"Reference image processed and saved to: {processed_path}")
93
- return processed_path
94
-
95
- # --- TAREFAS DE PR脡-PRODU脟脙O (Delegadas ao Pensador 2D) ---
96
-
97
- def task_generate_storyboard(self, prompt: str, num_keyframes: int, ref_image_paths: List[str],
98
- progress: gr.Progress) -> Tuple[List[str], str, Any]:
99
- """
100
- Delega a cria莽茫o do storyboard para o Deformes2DThinker.
101
- """
102
- logger.info(f"Act 1, Scene 1: Delegating storyboard creation to the Thinker.")
103
- progress(0.2, desc="Consulting the Thinker for the script...")
104
-
105
- storyboard = self.thinker.generate_storyboard(prompt, num_keyframes, ref_image_paths)
106
-
107
- logger.info(f"The Thinker returned the script: {storyboard}")
108
- self.director.update_state("storyboard", storyboard)
109
- self.director.update_state("processed_ref_paths", ref_image_paths)
110
- return storyboard, ref_image_paths[0], gr.update(visible=True, open=True)
111
-
112
- # A gera莽茫o de keyframes agora 茅 parte da produ莽茫o principal, ent茫o esta tarefa 茅 removida.
113
- # A sele莽茫o de keyframes para o modo fot贸grafo permanece.
114
- def task_select_keyframes(self, storyboard: List[str], base_ref_paths: List[str],
115
- pool_ref_paths: List[str]) -> List[str]:
116
- logger.info(f"Act 1, Scene 2 (Photographer Mode): Delegating keyframe selection to the Thinker.")
117
- selected_paths = self.thinker.select_keyframes_from_pool(storyboard, base_ref_paths, pool_ref_paths)
118
- self.director.update_state("keyframes", selected_paths)
119
- return selected_paths
120
-
121
-
122
- # --- TAREFA DE PRODU脟脙O UNIFICADA (Delegada ao Engenheiro-Chefe 7D) ---
123
-
124
- def task_produce_full_movie(self, initial_ref_paths: List[str], global_prompt: str,
125
- video_resolution: int, seconds_per_fragment: float,
126
- # ... outros par芒metros do Deformes4D
127
- trim_percent: int, handler_strength: float, dest_strength: float,
128
- guidance_scale: float, stg_scale: float, inference_steps: int,
129
- progress: gr.Progress) -> Dict[str, Any]:
130
- """
131
- Delega a produ莽茫o completa do filme para o Deformes7DEngine.
132
- """
133
- logger.info("Maestro: All systems go. Engaging the Turbo Intergalactic Engine (Deformes7D)...")
134
- storyboard = self.director.get_state("storyboard", [])
135
- if not storyboard:
136
- raise gr.Error("Storyboard not generated. Please complete Step 1 first.")
137
-
138
- ltx_params = {
139
- "guidance_scale": guidance_scale,
140
- "stg_scale": stg_scale,
141
- "num_inference_steps": inference_steps
142
- }
143
-
144
- # A chamada agora 茅 para a fun莽茫o unificada do motor 7D
145
- result = self.chief_engineer.generate_full_movie_interleaved(
146
- initial_ref_paths=initial_ref_paths,
147
- storyboard=storyboard,
148
- global_prompt=global_prompt,
149
- video_resolution=video_resolution,
150
- seconds_per_fragment=seconds_per_fragment,
151
- trim_percent=trim_percent,
152
- handler_strength=handler_strength,
153
- dest_strength=dest_strength,
154
- ltx_params=ltx_params,
155
- progress=progress
156
- )
157
-
158
- self.director.update_state("final_video_path", result["final_path"])
159
- self.director.update_state("all_keyframes", result["all_keyframes"])
160
- logger.info("Maestro: Deformes7D has completed the main production run.")
161
- return result
162
-
163
- # --- TAREFAS DE P脫S-PRODU脟脙O (Delegadas ao Engenheiro-Chefe 7D) ---
164
-
165
- def task_run_hd_mastering(self, source_video_path: str, model_version: str, steps: int, prompt: str, progress: gr.Progress) -> Generator[Dict[str, Any], None, None]:
166
- logger.info(f"Maestro: Delegating HD mastering to the Chief Engineer.")
167
- for update in self.chief_engineer.master_video_hd(
168
- source_video_path=source_video_path, model_version=model_version,
169
- steps=steps, prompt=prompt, progress=progress
170
- ):
171
- yield update
172
-
173
- def task_run_audio_generation(self, source_video_path: str, audio_prompt: str, progress: gr.Progress) -> Generator[Dict[str, Any], None, None]:
174
- logger.info(f"Maestro: Delegating audio generation to the Chief Engineer.")
175
- for update in self.chief_engineer.generate_audio(
176
- source_video_path=source_video_path, audio_prompt=audio_prompt, progress=progress
177
- ):
178
- yield update