khang119966 commited on
Commit
ed99f53
·
verified ·
1 Parent(s): 3538373

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -425,7 +425,7 @@ def generate_video(image, prompt, max_tokens):
425
  # Overlay ảnh heatmap lên ảnh gốc
426
  overlay = cv2.addWeighted(image, 1 - alpha, heatmap_color, alpha, 0)
427
 
428
- prev_text = generated_text[:-len(input_token)-len(predict_token_text)] + " "
429
  params_for_text.append((prev_text, input_token, predict_token_text))
430
 
431
  hidden_tabel = extract_next_token_table_data(model, tokenizer, generation_output, index_focus)
@@ -476,7 +476,7 @@ def generate_video(image, prompt, max_tokens):
476
  video = VideoFileClip("heatmap_animation.mp4")
477
  audio = AudioFileClip("legacy-of-the-century-background-cinematic-music-for-video-46-second-319542.mp3").set_duration(video.duration)
478
  final = video.set_audio(audio)
479
- final.write_videofile("heatmap_with_music.mp4", codec="libx264", audio_codec="aac")
480
 
481
  return "heatmap_with_music.mp4"
482
 
 
425
  # Overlay ảnh heatmap lên ảnh gốc
426
  overlay = cv2.addWeighted(image, 1 - alpha, heatmap_color, alpha, 0)
427
 
428
+ prev_text = generated_text[:-len(input_token)-len(predict_token_text)]
429
  params_for_text.append((prev_text, input_token, predict_token_text))
430
 
431
  hidden_tabel = extract_next_token_table_data(model, tokenizer, generation_output, index_focus)
 
476
  video = VideoFileClip("heatmap_animation.mp4")
477
  audio = AudioFileClip("legacy-of-the-century-background-cinematic-music-for-video-46-second-319542.mp3").set_duration(video.duration)
478
  final = video.set_audio(audio)
479
+ final.write_videofile("heatmap_with_music.mp4", codec="libx264", audio_codec="aac", ffmpeg_params=["-pix_fmt", "yuv420p"])
480
 
481
  return "heatmap_with_music.mp4"
482