Ahmadkhan12 commited on
Commit
a065125
Β·
verified Β·
1 Parent(s): 066c136

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -4,11 +4,11 @@ import ffmpeg
4
  import gradio as gr
5
  import traceback
6
 
7
- # Debug log list (for internal logging)
8
  debug_logs = []
9
 
10
  def log_message(message):
11
- """Log messages for internal debugging."""
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 # Just return None, no debug logs displayed
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 # If an error occurs, return None without the debug logs
83
 
84
- # Gradio Interface
85
  interface = gr.Interface(
86
  fn=process_video,
87
- inputs=gr.Video(label="Upload Video"),
88
- outputs=gr.Video(label="Video with Background Music"), # Only output the video
89
- title="Create Nature Vibes", # Changed the title
90
- description="Upload a video, and this app will add a background music track that matches the video duration, creating a soothing nature vibe."
 
 
 
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