testdeep123 commited on
Commit
a7922d3
·
verified ·
1 Parent(s): 48a1d98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -429,7 +429,7 @@ def generate_media(prompt, user_image=None, current_index=0, total_segments=1):
429
  else:
430
  print(f"Google Images search failed for prompt: {prompt}")
431
 
432
- if random.random() < 0.25:
433
  video_file = os.path.join(TEMP_FOLDER, f"{safe_prompt}_video.mp4")
434
  video_url = search_pexels_videos(prompt, PEXELS_API_KEY)
435
  if video_url:
@@ -837,7 +837,7 @@ def generate_video(user_input, resolution, caption_option):
837
  final_video = add_background_music(final_video, bg_music_volume=0.08)
838
 
839
  print(f"Exporting final video to {OUTPUT_VIDEO_FILENAME}...")
840
- final_video.write_videofile(OUTPUT_VIDEO_FILENAME, codec='libx264', fps=24, preset='veryfast')
841
  print(f"Final video saved as {OUTPUT_VIDEO_FILENAME}")
842
 
843
  # Clean up
@@ -852,8 +852,8 @@ iface = gr.Interface(
852
  fn=generate_video,
853
  inputs=[
854
  gr.Textbox(label="Video Concept", placeholder="Enter your video concept here..."),
855
- gr.Radio(["Full", "Short"], label="Resolution", value="Full"),
856
- gr.Radio(["Yes", "No"], label="Captions", value="Yes")
857
  ],
858
  outputs=gr.Video(label="Generated Video"),
859
  title="AI Documentary Video Generator",
 
429
  else:
430
  print(f"Google Images search failed for prompt: {prompt}")
431
 
432
+ if random.random() < 0.45:
433
  video_file = os.path.join(TEMP_FOLDER, f"{safe_prompt}_video.mp4")
434
  video_url = search_pexels_videos(prompt, PEXELS_API_KEY)
435
  if video_url:
 
837
  final_video = add_background_music(final_video, bg_music_volume=0.08)
838
 
839
  print(f"Exporting final video to {OUTPUT_VIDEO_FILENAME}...")
840
+ final_video.write_videofile(OUTPUT_VIDEO_FILENAME, codec='libx264', fps=60, preset='veryfast')
841
  print(f"Final video saved as {OUTPUT_VIDEO_FILENAME}")
842
 
843
  # Clean up
 
852
  fn=generate_video,
853
  inputs=[
854
  gr.Textbox(label="Video Concept", placeholder="Enter your video concept here..."),
855
+ gr.Radio(["Full", "Short"], label="Resolution", value="Short"),
856
+ gr.Radio(["Yes", "No"], label="Captions", value="No")
857
  ],
858
  outputs=gr.Video(label="Generated Video"),
859
  title="AI Documentary Video Generator",