Spaces:
Runtime error
Runtime error
Update audio_specialist.py
Browse files- audio_specialist.py +3 -3
audio_specialist.py
CHANGED
|
@@ -87,7 +87,7 @@ class AudioSpecialist:
|
|
| 87 |
gc.collect()
|
| 88 |
if torch.cuda.is_available(): torch.cuda.empty_cache()
|
| 89 |
|
| 90 |
-
def generate_audio_for_video(self, video_path: str, prompt: str, duration_seconds: float) -> str:
|
| 91 |
"""
|
| 92 |
Gera áudio para um arquivo de vídeo, aplicando um prompt negativo para evitar fala.
|
| 93 |
|
|
@@ -143,8 +143,8 @@ class AudioSpecialist:
|
|
| 143 |
audio_waveform = audios.float().cpu()[0]
|
| 144 |
|
| 145 |
fragment_name = Path(video_path).stem
|
| 146 |
-
output_video_path = os.path.join(self.workspace_dir, f"{fragment_name}_com_audio.mp4")
|
| 147 |
-
|
| 148 |
make_video(video_info, Path(output_video_path), audio_waveform, sampling_rate=self.seq_cfg.sampling_rate)
|
| 149 |
logger.info(f"--- Fragmento com áudio salvo em: {os.path.basename(output_video_path)}")
|
| 150 |
logger.info("------------------------------------------------------")
|
|
|
|
| 87 |
gc.collect()
|
| 88 |
if torch.cuda.is_available(): torch.cuda.empty_cache()
|
| 89 |
|
| 90 |
+
def generate_audio_for_video(self, video_path: str, prompt: str, duration_seconds: float, output_path_override: str = None) -> str:
|
| 91 |
"""
|
| 92 |
Gera áudio para um arquivo de vídeo, aplicando um prompt negativo para evitar fala.
|
| 93 |
|
|
|
|
| 143 |
audio_waveform = audios.float().cpu()[0]
|
| 144 |
|
| 145 |
fragment_name = Path(video_path).stem
|
| 146 |
+
output_video_path = output_path_override if output_path_override else os.path.join(self.workspace_dir, f"{fragment_name}_com_audio.mp4")
|
| 147 |
+
|
| 148 |
make_video(video_info, Path(output_video_path), audio_waveform, sampling_rate=self.seq_cfg.sampling_rate)
|
| 149 |
logger.info(f"--- Fragmento com áudio salvo em: {os.path.basename(output_video_path)}")
|
| 150 |
logger.info("------------------------------------------------------")
|