Ahmadkhan12 commited on
Commit
066c136
·
verified ·
1 Parent(s): 7048a54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
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 debugging."""
12
  debug_logs.append(message)
13
  print(message)
14
 
@@ -71,23 +71,21 @@ 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, "\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
84
  interface = gr.Interface(
85
  fn=process_video,
86
  inputs=gr.Video(label="Upload Video"),
87
- outputs=[
88
- gr.Video(label="Video with Background Music"),
89
- gr.Textbox(label="Debug Logs")
90
- ],
91
  title="Create Nature Vibes", # Changed the title
92
  description="Upload a video, and this app will add a background music track that matches the video duration, creating a soothing nature vibe."
93
  )
 
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
 
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
  )