besarismaili commited on
Commit
5d8217d
·
1 Parent(s): 134e0da
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -46,14 +46,15 @@ def anim(f_promt, s_promt, stability_key):
46
  repo_dir = os.getenv('HF_COMET_ROOT_PATH', '/')
47
 
48
  # Define output folder path
49
- output_dir = os.path.join("https://huggingface.co/spaces/besarismaili/sdanim/tree/main/output")
 
50
 
51
  # Render each frame of animation
52
  for idx, frame in enumerate(animator.render()):
53
  file_path = os.path.join(output_dir, f"frame_{idx:05d}.png")
54
  frame.save(file_path)
55
  print("Created frame at:"+file_path)
56
- yield gr.Files(value=file_path)
57
 
58
  with gr.Blocks() as demo:
59
  gr.Markdown("Stability Animation")
@@ -61,7 +62,7 @@ with gr.Blocks() as demo:
61
  s_promt = gr.Textbox(label="Second Prompt", value="a photo of a cute dog")
62
  stability_key = gr.Textbox(label="Stability Key", value="")
63
 
64
- outimg = gr.File(label="Generated Files")
65
  btn = gr.Button('Anim')
66
 
67
  btn.click(fn=anim, inputs=[f_promt, s_promt, stability_key], outputs=[outimg],api_name="AnimAPI")
 
46
  repo_dir = os.getenv('HF_COMET_ROOT_PATH', '/')
47
 
48
  # Define output folder path
49
+ output_dir = os.path.join(repo_dir, "output")
50
+ image_path = "/tmp/frames/"
51
 
52
  # Render each frame of animation
53
  for idx, frame in enumerate(animator.render()):
54
  file_path = os.path.join(output_dir, f"frame_{idx:05d}.png")
55
  frame.save(file_path)
56
  print("Created frame at:"+file_path)
57
+ yield gr.Image(value=file_path)
58
 
59
  with gr.Blocks() as demo:
60
  gr.Markdown("Stability Animation")
 
62
  s_promt = gr.Textbox(label="Second Prompt", value="a photo of a cute dog")
63
  stability_key = gr.Textbox(label="Stability Key", value="")
64
 
65
+ outimg = gr.Image(label="Generated Files")
66
  btn = gr.Button('Anim')
67
 
68
  btn.click(fn=anim, inputs=[f_promt, s_promt, stability_key], outputs=[outimg],api_name="AnimAPI")