ziqiangao commited on
Commit
7835f68
·
1 Parent(s): d511aa1

add debug logs

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -243,7 +243,17 @@ def main(file, name, fps=30, res: tuple=(1280,720), oscres=512, sr=11025, lyrics
243
 
244
  # Prepare parameters for each frame
245
  params = [(n, samples_array, cover_img, title, artist, dominant_color, width, height, fps, name, oscres, sr) for n in range(num_frames)]
246
-
 
 
 
 
 
 
 
 
 
 
247
  try:
248
  with Pool(cpu_count()) as pool:
249
  num_frames = len(samples_array) // (sr // fps)
@@ -251,12 +261,14 @@ def main(file, name, fps=30, res: tuple=(1280,720), oscres=512, sr=11025, lyrics
251
  for _ in pool.imap_unordered(render_frame, params):
252
  iii += 1 # Increment frame count for progress
253
  p((iii, num_frames), desc="Rendering Frames")
 
254
 
255
  except Exception as e:
256
  raise gr.Error("Something went wrong whilst rendering")
257
 
258
  p = gr.Progress()
259
  p(0.5, desc="Compiling video")
 
260
  print('FFMPEG')
261
  if haslyrics:
262
  ffmpeg_cmd = [
@@ -287,7 +299,7 @@ def main(file, name, fps=30, res: tuple=(1280,720), oscres=512, sr=11025, lyrics
287
  path + f'{name}.mp4' # Output MP4 filename
288
  ]
289
  subprocess.run(ffmpeg_cmd)
290
-
291
  return f"{name}.mp4", haslyrics
292
 
293
  def gradio_interface(audio_file, lyrics, output_name, fps=30, vidwidth=1280, vidheight=720, oscres=512, img=None, tit=None, ast=None):
 
243
 
244
  # Prepare parameters for each frame
245
  params = [(n, samples_array, cover_img, title, artist, dominant_color, width, height, fps, name, oscres, sr) for n in range(num_frames)]
246
+ print('---------------------------------------------------------')
247
+ print('Info:')
248
+ print("Title: " + title)
249
+ print("Artist: " + artist)
250
+ print(f'Resolution: {str(width)}x{str(height)}')
251
+ print("Background Colour: " + str(dominant_color))
252
+ print('Framerate: ' + str(fps))
253
+ print('Frame Count: ' + str(num_frames))
254
+ print('Segments per frame: ' + str(oscres))
255
+ print('---------------------------------------------------------')
256
+ print('Rendering:')
257
  try:
258
  with Pool(cpu_count()) as pool:
259
  num_frames = len(samples_array) // (sr // fps)
 
261
  for _ in pool.imap_unordered(render_frame, params):
262
  iii += 1 # Increment frame count for progress
263
  p((iii, num_frames), desc="Rendering Frames")
264
+ print(f'Frame {iii}/{num_frames}')
265
 
266
  except Exception as e:
267
  raise gr.Error("Something went wrong whilst rendering")
268
 
269
  p = gr.Progress()
270
  p(0.5, desc="Compiling video")
271
+ print('---------------------------------------------------------')
272
  print('FFMPEG')
273
  if haslyrics:
274
  ffmpeg_cmd = [
 
299
  path + f'{name}.mp4' # Output MP4 filename
300
  ]
301
  subprocess.run(ffmpeg_cmd)
302
+ print('---------------------------------------------------------')
303
  return f"{name}.mp4", haslyrics
304
 
305
  def gradio_interface(audio_file, lyrics, output_name, fps=30, vidwidth=1280, vidheight=720, oscres=512, img=None, tit=None, ast=None):