Spaces:
vilarin
/
Running on Zero

vilarin commited on
Commit
2b0f02c
1 Parent(s): 8b3ca8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -4,6 +4,9 @@ from diffusers import DiffusionPipeline, UNet2DConditionModel, LCMScheduler
4
  from huggingface_hub import hf_hub_download
5
  import spaces
6
  from PIL import Image
 
 
 
7
 
8
  # Constants
9
  base = "stabilityai/stable-diffusion-xl-base-1.0"
@@ -62,7 +65,7 @@ examples = [
62
 
63
  # Gradio Interface
64
 
65
- with gr.Blocks(css=CSS) as demo:
66
  gr.HTML("<h1><center>Adobe DMD2🦖</center></h1>")
67
  gr.HTML("<p><center><a href='https://huggingface.co/tianweiy/DMD2'>DMD2</a> text-to-image generation</center></p>")
68
  with gr.Group():
@@ -76,7 +79,7 @@ with gr.Blocks(css=CSS) as demo:
76
  inputs=prompt,
77
  outputs=img,
78
  fn=generate_image,
79
- cache_examples=True,
80
  )
81
 
82
  prompt.submit(fn=generate_image,
 
4
  from huggingface_hub import hf_hub_download
5
  import spaces
6
  from PIL import Image
7
+ import os
8
+
9
+ CACHE_EXAMPLES = torch.cuda.is_available() and os.getenv("CACHE_EXAMPLES", "1") == "1"
10
 
11
  # Constants
12
  base = "stabilityai/stable-diffusion-xl-base-1.0"
 
65
 
66
  # Gradio Interface
67
 
68
+ with gr.Blocks(css=CSS, theme="soft") as demo:
69
  gr.HTML("<h1><center>Adobe DMD2🦖</center></h1>")
70
  gr.HTML("<p><center><a href='https://huggingface.co/tianweiy/DMD2'>DMD2</a> text-to-image generation</center></p>")
71
  with gr.Group():
 
79
  inputs=prompt,
80
  outputs=img,
81
  fn=generate_image,
82
+ cache_examples=CACHE_EXAMPLES,
83
  )
84
 
85
  prompt.submit(fn=generate_image,