multimodalart HF Staff commited on
Commit
835ddf1
·
verified ·
1 Parent(s): aa0696d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -50,7 +50,6 @@ def _resize_image(image_path: str, target_size: Tuple[int, int]) -> str:
50
  with Image.open(image_path) as img:
51
  if img.size == target_size:
52
  return image_path
53
- gr.Info(f"Resizing image to {target_size[0]}x{target_size[1]} to match previous video.")
54
  resized_img = img.resize(target_size, Image.Resampling.LANCZOS)
55
  suffix = os.path.splitext(image_path)[1] or ".png"
56
  with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as tmp_file:
@@ -59,7 +58,6 @@ def _resize_image(image_path: str, target_size: Tuple[int, int]) -> str:
59
 
60
  def _trim_first_frame_fast(video_path: str) -> str:
61
  """Removes exactly the first frame of a video without re-encoding."""
62
- gr.Info("Preparing video segment...")
63
  with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as tmp_output_file:
64
  output_path = tmp_output_file.name
65
  try:
@@ -78,7 +76,6 @@ def _trim_first_frame_fast(video_path: str) -> str:
78
 
79
  def _combine_videos_simple(video1_path: str, video2_path: str) -> str:
80
  """Combines two videos using the fast concat demuxer."""
81
- gr.Info("Stitching videos...")
82
  with tempfile.NamedTemporaryFile(delete=False, mode='w', suffix=".txt") as tmp_list_file:
83
  tmp_list_file.write(f"file '{os.path.abspath(video1_path)}'\n")
84
  tmp_list_file.write(f"file '{os.path.abspath(video2_path)}'\n")
@@ -101,7 +98,6 @@ def _combine_videos_simple(video1_path: str, video2_path: str) -> str:
101
 
102
  def _generate_video_segment(input_image_path: str, output_image_path: str, prompt: str, token: str) -> str:
103
  """Generates a single video segment using the external service."""
104
- gr.Info("Generating new video segment...")
105
  video_client = Client("multimodalart/wan-2-2-first-last-frame", hf_token=token)
106
  result = video_client.predict(
107
  start_image_pil=handle_file(input_image_path),
@@ -195,7 +191,7 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=css) as demo:
195
  use_image_button = gr.Button("♻️ Use this Image for Next Edit", variant="primary")
196
  with gr.Row():
197
  create_video_button = gr.Button("Create a video between the two images 🎥", variant="secondary", visible=False)
198
- extend_video_button = gr.Button("Extend video with new scene 🎞️", variant="secondary", visible=False)
199
  with gr.Group(visible=False) as video_group:
200
  video_output = gr.Video(label="Generated Video", show_download_button=True, autoplay=True)
201
  gr.Markdown("Generate more with [Wan 2.2 first-last-frame](https://huggingface.co/spaces/multimodalart/wan-2-2-first-last-frame)", elem_id="wan_ad")
 
50
  with Image.open(image_path) as img:
51
  if img.size == target_size:
52
  return image_path
 
53
  resized_img = img.resize(target_size, Image.Resampling.LANCZOS)
54
  suffix = os.path.splitext(image_path)[1] or ".png"
55
  with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as tmp_file:
 
58
 
59
  def _trim_first_frame_fast(video_path: str) -> str:
60
  """Removes exactly the first frame of a video without re-encoding."""
 
61
  with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as tmp_output_file:
62
  output_path = tmp_output_file.name
63
  try:
 
76
 
77
  def _combine_videos_simple(video1_path: str, video2_path: str) -> str:
78
  """Combines two videos using the fast concat demuxer."""
 
79
  with tempfile.NamedTemporaryFile(delete=False, mode='w', suffix=".txt") as tmp_list_file:
80
  tmp_list_file.write(f"file '{os.path.abspath(video1_path)}'\n")
81
  tmp_list_file.write(f"file '{os.path.abspath(video2_path)}'\n")
 
98
 
99
  def _generate_video_segment(input_image_path: str, output_image_path: str, prompt: str, token: str) -> str:
100
  """Generates a single video segment using the external service."""
 
101
  video_client = Client("multimodalart/wan-2-2-first-last-frame", hf_token=token)
102
  result = video_client.predict(
103
  start_image_pil=handle_file(input_image_path),
 
191
  use_image_button = gr.Button("♻️ Use this Image for Next Edit", variant="primary")
192
  with gr.Row():
193
  create_video_button = gr.Button("Create a video between the two images 🎥", variant="secondary", visible=False)
194
+ extend_video_button = gr.Button("Extend existing video with new scene 🎞️", variant="secondary", visible=False)
195
  with gr.Group(visible=False) as video_group:
196
  video_output = gr.Video(label="Generated Video", show_download_button=True, autoplay=True)
197
  gr.Markdown("Generate more with [Wan 2.2 first-last-frame](https://huggingface.co/spaces/multimodalart/wan-2-2-first-last-frame)", elem_id="wan_ad")