Kevin commited on
Commit
859c0cf
1 Parent(s): 6ee2eb6

Fix video update

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -8,7 +8,7 @@ from datetime import datetime
8
  from morph_attn import DiffMorpherPipeline
9
  from lora_utils import train_lora
10
 
11
- LENGTH=480
12
 
13
  def train_lora_interface(
14
  image,
@@ -69,12 +69,13 @@ def run_diffmorpher(
69
  progress=gr.Progress()
70
  )
71
  video_path = f"{output_path}/{run_id}.mp4"
72
- video = cv2.VideoWriter(video_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (LENGTH, LENGTH))
73
- for image in images:
 
74
  video.write(cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR))
75
  video.release()
76
  cv2.destroyAllWindows()
77
- return output_video.update(value=video_path)
78
 
79
  def run_all(
80
  image_0,
@@ -164,7 +165,7 @@ with gr.Blocks() as demo:
164
  4. Click **"Run w/o LoRA training"**
165
 
166
  ### Note:
167
- 1. To speed up the generation process, you can **ruduce the number of frames** or **turn off "Use Reschedule"** ("Use Reschedule" will double the generation time).
168
  2. You can try the influence of different prompts. It seems that using the same prompts or aligned prompts works better.
169
  ### Have fun!
170
  """)
 
8
  from morph_attn import DiffMorpherPipeline
9
  from lora_utils import train_lora
10
 
11
+ LENGTH=450
12
 
13
  def train_lora_interface(
14
  image,
 
69
  progress=gr.Progress()
70
  )
71
  video_path = f"{output_path}/{run_id}.mp4"
72
+ video = cv2.VideoWriter(video_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (512, 512))
73
+ for i, image in enumerate(images):
74
+ # image.save(f"{output_path}/{i}.png")
75
  video.write(cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR))
76
  video.release()
77
  cv2.destroyAllWindows()
78
+ return gr.Video(value=video_path, format="mp4", label="Output video", show_label=True, height=LENGTH, width=LENGTH, interactive=False)
79
 
80
  def run_all(
81
  image_0,
 
165
  4. Click **"Run w/o LoRA training"**
166
 
167
  ### Note:
168
+ 1. To speed up the generation process, you can **ruduce the number of frames** or **turn off "Use Reschedule"**.
169
  2. You can try the influence of different prompts. It seems that using the same prompts or aligned prompts works better.
170
  ### Have fun!
171
  """)