Disable cache examples when duplicating

#13
by multimodalart HF staff - opened
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -23,6 +23,12 @@ snapshot_download(repo_id="runwayml/stable-diffusion-v1-5", local_dir="./stable-
23
  snapshot_download(repo_id="stabilityai/sd-vae-ft-mse", local_dir="./sd-vae-ft-mse")
24
  snapshot_download(repo_id="zcxu-eric/MagicAnimate", local_dir="./MagicAnimate")
25
 
 
 
 
 
 
 
26
  animator = MagicAnimate()
27
 
28
  def animate(reference_image, motion_sequence_state, seed=1, steps=25, guidance_scale=7.5):
@@ -101,7 +107,7 @@ with gr.Blocks() as demo:
101
  ],
102
  inputs=[reference_image, motion_sequence],
103
  outputs=animation,
104
- cache_examples=True
105
  )
106
 
107
  demo.queue(max_size=15)
 
23
  snapshot_download(repo_id="stabilityai/sd-vae-ft-mse", local_dir="./sd-vae-ft-mse")
24
  snapshot_download(repo_id="zcxu-eric/MagicAnimate", local_dir="./MagicAnimate")
25
 
26
+ is_spaces = True if "SPACE_ID" in os.environ else False
27
+ true_for_shared_ui = False #This will be true only if you are in a shared UI
28
+ if(is_spaces):
29
+ true_for_shared_ui = True if "zcxu-eric/magicanimate" in os.environ['SPACE_ID'] else False
30
+
31
+
32
  animator = MagicAnimate()
33
 
34
  def animate(reference_image, motion_sequence_state, seed=1, steps=25, guidance_scale=7.5):
 
107
  ],
108
  inputs=[reference_image, motion_sequence],
109
  outputs=animation,
110
+ cache_examples=true_for_shared_ui
111
  )
112
 
113
  demo.queue(max_size=15)