besarismaili commited on
Commit
5aef69b
·
1 Parent(s): 049f113
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -52,11 +52,14 @@ def anim(f_promt, s_promt, stability_key):
52
  if not os.path.exists(output_dir):
53
  os.makedirs(output_dir)
54
  # Render each frame of animation
 
55
  for idx, frame in enumerate(animator.render()):
56
  file_path = os.path.join(output_dir, f"frame_{idx:05d}.png")
57
  frame.save(file_path)
58
  print("Created frame at:"+file_path)
59
- yield gr.Image(value=file_path)
 
 
60
 
61
  with gr.Blocks() as demo:
62
  gr.Markdown("Stability Animation")
@@ -67,6 +70,6 @@ with gr.Blocks() as demo:
67
  outimg = gr.Image(label="Generated Files")
68
  btn = gr.Button('Anim')
69
 
70
- btn.click(fn=anim, inputs=[f_promt, s_promt, stability_key], outputs=[outimg],api_name="AnimAPI")
71
 
72
  demo.launch()
 
52
  if not os.path.exists(output_dir):
53
  os.makedirs(output_dir)
54
  # Render each frame of animation
55
+ images = []
56
  for idx, frame in enumerate(animator.render()):
57
  file_path = os.path.join(output_dir, f"frame_{idx:05d}.png")
58
  frame.save(file_path)
59
  print("Created frame at:"+file_path)
60
+ images.append(gr.Image(value=file_path))
61
+
62
+ return images
63
 
64
  with gr.Blocks() as demo:
65
  gr.Markdown("Stability Animation")
 
70
  outimg = gr.Image(label="Generated Files")
71
  btn = gr.Button('Anim')
72
 
73
+ btn.click(fn=anim, inputs=[f_promt, s_promt, stability_key], outputs=[outimg],api_name="AnimAPI", result_format="list")
74
 
75
  demo.launch()