Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,11 +4,11 @@ import ffmpeg
|
|
4 |
import gradio as gr
|
5 |
import traceback
|
6 |
|
7 |
-
# Debug log list
|
8 |
debug_logs = []
|
9 |
|
10 |
def log_message(message):
|
11 |
-
"""Log messages for
|
12 |
debug_logs.append(message)
|
13 |
print(message)
|
14 |
|
@@ -71,23 +71,25 @@ def process_video(uploaded_video):
|
|
71 |
|
72 |
output_video = add_music_to_video(video_path, chunks_folder="./chunks")
|
73 |
if "Error" in output_video:
|
74 |
-
return None
|
75 |
-
|
76 |
-
return output_video # Only return the output video
|
77 |
|
|
|
78 |
except Exception as e:
|
79 |
error_message = f"Error in process_video: {str(e)}"
|
80 |
log_message(error_message)
|
81 |
traceback.print_exc()
|
82 |
-
return None
|
83 |
|
84 |
-
# Gradio Interface
|
85 |
interface = gr.Interface(
|
86 |
fn=process_video,
|
87 |
-
inputs=gr.Video(label="Upload Video"),
|
88 |
-
outputs=
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
91 |
)
|
92 |
|
93 |
# Launch Gradio app
|
|
|
4 |
import gradio as gr
|
5 |
import traceback
|
6 |
|
7 |
+
# Debug log list
|
8 |
debug_logs = []
|
9 |
|
10 |
def log_message(message):
|
11 |
+
"""Log messages for debugging."""
|
12 |
debug_logs.append(message)
|
13 |
print(message)
|
14 |
|
|
|
71 |
|
72 |
output_video = add_music_to_video(video_path, chunks_folder="./chunks")
|
73 |
if "Error" in output_video:
|
74 |
+
return None, "\n".join(debug_logs)
|
|
|
|
|
75 |
|
76 |
+
return output_video, "\n".join(debug_logs)
|
77 |
except Exception as e:
|
78 |
error_message = f"Error in process_video: {str(e)}"
|
79 |
log_message(error_message)
|
80 |
traceback.print_exc()
|
81 |
+
return None, "\n".join(debug_logs)
|
82 |
|
83 |
+
# Gradio Interface with more nature and music-themed emojis
|
84 |
interface = gr.Interface(
|
85 |
fn=process_video,
|
86 |
+
inputs=gr.Video(label="πΏ Upload Your Video π±"),
|
87 |
+
outputs=[
|
88 |
+
gr.Video(label="πΆ Your Video with Nature's Vibes π³π§"),
|
89 |
+
gr.Textbox(label="π Debug Logs π")
|
90 |
+
],
|
91 |
+
title="Create Nature Vibes πΏππΆ",
|
92 |
+
description="π³π» Upload a video, and this app will add a 10-second nature-inspired background music track πΆ that matches the video duration πΏπ. Let the natural vibes flow! π§"
|
93 |
)
|
94 |
|
95 |
# Launch Gradio app
|