acmyu commited on
Commit
2743866
·
1 Parent(s): 4c37470

return thumbnails

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. main.py +9 -1
app.py CHANGED
@@ -23,6 +23,7 @@ with gr.Blocks() as demo:
23
  with gr.Column():
24
  animation = gr.Video(label="Result")
25
  frames = gr.Gallery(type="pil", label="Frames", format="png")
 
26
 
27
  submit_btn.click(
28
  run_app, inputs=[char_imgs, mocap, tr_steps, inf_steps, fps, remove_bg, resize_inputs], outputs=[animation, frames]
@@ -33,7 +34,7 @@ with gr.Blocks() as demo:
33
  )
34
 
35
  inference_btn.click(
36
- run_inference, inputs=[char_imgs, mocap, tr_steps, inf_steps, fps, modelId, remove_bg, resize_inputs], outputs=[animation, frames]
37
  )
38
 
39
 
 
23
  with gr.Column():
24
  animation = gr.Video(label="Result")
25
  frames = gr.Gallery(type="pil", label="Frames", format="png")
26
+ frames_thumb = gr.Gallery(type="pil", label="Thumbnails", format="png")
27
 
28
  submit_btn.click(
29
  run_app, inputs=[char_imgs, mocap, tr_steps, inf_steps, fps, remove_bg, resize_inputs], outputs=[animation, frames]
 
34
  )
35
 
36
  inference_btn.click(
37
+ run_inference, inputs=[char_imgs, mocap, tr_steps, inf_steps, fps, modelId, remove_bg, resize_inputs], outputs=[animation, frames, frames_thumb]
38
  )
39
 
40
 
main.py CHANGED
@@ -127,6 +127,14 @@ def save_temp_imgs(imgs):
127
  return results
128
 
129
 
 
 
 
 
 
 
 
 
130
  # Pose detection ==============================================================================================
131
 
132
  def load_models():
@@ -1113,7 +1121,7 @@ def run_inference(images, video_path, train_steps=100, inference_steps=10, fps=1
1113
 
1114
  print("Done!")
1115
 
1116
- return out_vid+'.webm', results
1117
 
1118
 
1119
  def run_app(images, video_path, train_steps=100, inference_steps=10, fps=12, bg_remove=False, resize_inputs=True):
 
127
  return results
128
 
129
 
130
+ def getThumbnails(imgs):
131
+ thumbs = []
132
+ thumb_size = (256, 256)
133
+ for img in imgs:
134
+ thumbs.append(img.thumbnail(thumb_size))
135
+ return thumbs
136
+
137
+
138
  # Pose detection ==============================================================================================
139
 
140
  def load_models():
 
1121
 
1122
  print("Done!")
1123
 
1124
+ return out_vid+'.webm', results, getThumbnails(results)
1125
 
1126
 
1127
  def run_app(images, video_path, train_steps=100, inference_steps=10, fps=12, bg_remove=False, resize_inputs=True):