Spaces:
Sleeping
Sleeping
Update ltx_upscaler_manager_helpers.py
Browse files
ltx_upscaler_manager_helpers.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
#--- START OF MODIFIED FILE app_fluxContext_Ltx/ltx_upscaler_manager_helpers.py ---
|
| 2 |
# ltx_upscaler_manager_helpers.py
|
| 3 |
# Gerente de Pool para o revezamento de workers de Upscaling.
|
| 4 |
# Este arquivo é parte do projeto Euia-AducSdr e está sob a licença AGPL v3.
|
|
@@ -49,22 +48,21 @@ class LtxUpscalerPoolManager:
|
|
| 49 |
self.current_worker_index = (self.current_worker_index + 1) % len(self.workers)
|
| 50 |
return worker_to_use
|
| 51 |
|
| 52 |
-
def
|
| 53 |
-
"""Seleciona um worker livre e faz o upscale de um
|
| 54 |
worker_to_use = self._get_worker()
|
| 55 |
-
try
|
| 56 |
-
print(f"UPSCALER POOL MANAGER: Worker em {worker_to_use.device} iniciando upscale de {os.path.basename(
|
| 57 |
-
result_path = worker_to_use.
|
| 58 |
-
print(f"UPSCALER POOL MANAGER: Upscale de {os.path.basename(
|
| 59 |
return result_path
|
| 60 |
finally:
|
| 61 |
-
# A limpeza do worker será feita na próxima chamada
|
| 62 |
pass
|
| 63 |
|
| 64 |
def decode_single_latent_frame(self, latent_frame_tensor: torch.Tensor) -> Image.Image:
|
| 65 |
"""Seleciona um worker livre e decodifica um único frame latente para uma imagem PIL."""
|
| 66 |
worker_to_use = self._get_worker()
|
| 67 |
-
try
|
| 68 |
print(f"UPSCALER POOL MANAGER: Worker em {worker_to_use.device} decodificando frame latente...")
|
| 69 |
image = worker_to_use.decode_single_latent_frame(latent_frame_tensor)
|
| 70 |
print(f"UPSCALER POOL MANAGER: Decodificação concluída.")
|
|
@@ -72,6 +70,4 @@ class LtxUpscalerPoolManager:
|
|
| 72 |
finally:
|
| 73 |
pass
|
| 74 |
|
| 75 |
-
|
| 76 |
-
ltx_upscaler_manager_singleton = LtxUpscalerPoolManager(device_ids=['cuda:0', 'cuda:1'])
|
| 77 |
-
#--- END OF MODIFIED FILE app_fluxContext_Ltx/ltx_upscaler_manager_helpers.py ---
|
|
|
|
|
|
|
| 1 |
# ltx_upscaler_manager_helpers.py
|
| 2 |
# Gerente de Pool para o revezamento de workers de Upscaling.
|
| 3 |
# Este arquivo é parte do projeto Euia-AducSdr e está sob a licença AGPL v3.
|
|
|
|
| 48 |
self.current_worker_index = (self.current_worker_index + 1) % len(self.workers)
|
| 49 |
return worker_to_use
|
| 50 |
|
| 51 |
+
def upscale_video_fragment(self, video_path_low_res: str, output_path: str, video_fps: int):
|
| 52 |
+
"""Seleciona um worker livre e faz o upscale de um vídeo para vídeo."""
|
| 53 |
worker_to_use = self._get_worker()
|
| 54 |
+
try:
|
| 55 |
+
print(f"UPSCALER POOL MANAGER: Worker em {worker_to_use.device} iniciando upscale de {os.path.basename(video_path_low_res)}...")
|
| 56 |
+
result_path = worker_to_use.upscale_video_fragment(video_path_low_res, output_path, video_fps)
|
| 57 |
+
print(f"UPSCALER POOL MANAGER: Upscale de {os.path.basename(video_path_low_res)} concluído.")
|
| 58 |
return result_path
|
| 59 |
finally:
|
|
|
|
| 60 |
pass
|
| 61 |
|
| 62 |
def decode_single_latent_frame(self, latent_frame_tensor: torch.Tensor) -> Image.Image:
|
| 63 |
"""Seleciona um worker livre e decodifica um único frame latente para uma imagem PIL."""
|
| 64 |
worker_to_use = self._get_worker()
|
| 65 |
+
try:
|
| 66 |
print(f"UPSCALER POOL MANAGER: Worker em {worker_to_use.device} decodificando frame latente...")
|
| 67 |
image = worker_to_use.decode_single_latent_frame(latent_frame_tensor)
|
| 68 |
print(f"UPSCALER POOL MANAGER: Decodificação concluída.")
|
|
|
|
| 70 |
finally:
|
| 71 |
pass
|
| 72 |
|
| 73 |
+
ltx_upscaler_manager_singleton = LtxUpscalerPoolManager(device_ids=['cuda:0', 'cuda:1'])
|
|
|
|
|
|