shipra-99 commited on
Commit
0124f58
·
verified ·
1 Parent(s): eb5307b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
app.py CHANGED
@@ -10,19 +10,23 @@ def process_audio(audio_file):
10
  # Ensure input is a valid filepath for Gradio 3.x
11
  if isinstance(audio_file, dict):
12
  audio_file = audio_file['name']
13
-
14
- # Comprehensive error logging
15
  print(f"Processing audio file: {audio_file}")
16
- print(f"File exists: {os.path.exists(audio_file)}")
17
- print(f"Current working directory: {os.getcwd()}")
18
- print(f"Python path: {sys.path}")
19
-
20
- # Validate input file
21
- if not audio_file or not os.path.exists(audio_file):
22
  error_msg = f"Invalid or non-existent audio file: {audio_file}"
23
  print(error_msg)
24
  return None, error_msg
25
 
 
 
 
 
26
  # Ensure output directories exist
27
  os.makedirs("visualise/video/body-pixel2", exist_ok=True)
28
 
@@ -37,6 +41,7 @@ def process_audio(audio_file):
37
  "--whole_body"
38
  ]
39
 
 
40
  print(f"Executing command: {' '.join(cmd)}")
41
 
42
  # Run with error capture
@@ -74,6 +79,7 @@ def process_audio(audio_file):
74
  output_dir = f"visualise/video/body-pixel2/{audio_name}"
75
  output_path = f"{output_dir}/1st-page.mp4"
76
 
 
77
  print(f"Expected output path: {output_path}")
78
  print(f"Output directory contents: {os.listdir(output_dir) if os.path.exists(output_dir) else 'Directory not found'}")
79
 
@@ -111,4 +117,4 @@ if __name__ == "__main__":
111
  server_name="0.0.0.0",
112
  server_port=7860,
113
  debug=True
114
- )
 
10
  # Ensure input is a valid filepath for Gradio 3.x
11
  if isinstance(audio_file, dict):
12
  audio_file = audio_file['name']
13
+
14
+ # Log the audio file being processed
15
  print(f"Processing audio file: {audio_file}")
16
+
17
+ # Check if the file exists
18
+ file_exists = os.path.exists(audio_file)
19
+ print(f"File exists: {file_exists}")
20
+
21
+ if not file_exists:
22
  error_msg = f"Invalid or non-existent audio file: {audio_file}"
23
  print(error_msg)
24
  return None, error_msg
25
 
26
+ # Log current working directory and Python path for context
27
+ print(f"Current working directory: {os.getcwd()}")
28
+ print(f"Python path: {sys.path}")
29
+
30
  # Ensure output directories exist
31
  os.makedirs("visualise/video/body-pixel2", exist_ok=True)
32
 
 
41
  "--whole_body"
42
  ]
43
 
44
+ # Log the constructed command
45
  print(f"Executing command: {' '.join(cmd)}")
46
 
47
  # Run with error capture
 
79
  output_dir = f"visualise/video/body-pixel2/{audio_name}"
80
  output_path = f"{output_dir}/1st-page.mp4"
81
 
82
+ # Log expected output path and directory contents
83
  print(f"Expected output path: {output_path}")
84
  print(f"Output directory contents: {os.listdir(output_dir) if os.path.exists(output_dir) else 'Directory not found'}")
85
 
 
117
  server_name="0.0.0.0",
118
  server_port=7860,
119
  debug=True
120
+ )