Update app.py
Browse files
app.py
CHANGED
|
@@ -26,6 +26,9 @@ if service_account_info:
|
|
| 26 |
output_folder = "outputs"
|
| 27 |
os.makedirs(output_folder, exist_ok=True)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
| 29 |
def resize_and_blur_video(clip, target_aspect_ratio=16/9):
|
| 30 |
"""Redimensiona y aplica desenfoque al fondo del video para mantener el aspecto 16:9."""
|
| 31 |
try:
|
|
@@ -165,15 +168,17 @@ def process_input(text, txt_file, mp3_file, selected_voice, rate, pitch, keyword
|
|
| 165 |
final_video_path = combine_audio_video(audio_file, video_clip, music_clip)
|
| 166 |
if not final_video_path:
|
| 167 |
raise ValueError("Failed to combine audio and video")
|
| 168 |
-
#
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
| 177 |
|
| 178 |
# Interfaz Gradio
|
| 179 |
with gr.Blocks() as demo:
|
|
|
|
| 26 |
output_folder = "outputs"
|
| 27 |
os.makedirs(output_folder, exist_ok=True)
|
| 28 |
|
| 29 |
+
# ID de la carpeta de destino en Google Drive
|
| 30 |
+
FOLDER_ID = "12S6adpanAXjf71pKKGRRPqpzbJa5XEh3" # Reemplaza con tu ID de carpeta
|
| 31 |
+
|
| 32 |
def resize_and_blur_video(clip, target_aspect_ratio=16/9):
|
| 33 |
"""Redimensiona y aplica desenfoque al fondo del video para mantener el aspecto 16:9."""
|
| 34 |
try:
|
|
|
|
| 168 |
final_video_path = combine_audio_video(audio_file, video_clip, music_clip)
|
| 169 |
if not final_video_path:
|
| 170 |
raise ValueError("Failed to combine audio and video")
|
| 171 |
+
# Subimos a Google Drive
|
| 172 |
+
video_id = upload_to_google_drive(final_video_path, folder_id=FOLDER_ID)
|
| 173 |
+
if video_id:
|
| 174 |
+
print(f"Video subido a Google Drive con ID: {video_id}")
|
| 175 |
+
else:
|
| 176 |
+
print("Error subiendo el video a Google Drive")
|
| 177 |
+
|
| 178 |
+
return final_video_path
|
| 179 |
+
except Exception as e:
|
| 180 |
+
print(f"Error durante el procesamiento: {e}")
|
| 181 |
+
return None
|
| 182 |
|
| 183 |
# Interfaz Gradio
|
| 184 |
with gr.Blocks() as demo:
|