ZennyKenny commited on
Commit
7af42b0
·
verified ·
1 Parent(s): a085baf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -26
app.py CHANGED
@@ -64,13 +64,27 @@ examples = [
64
  ]
65
 
66
  css = """
67
- #col-container {
68
- margin: 0 auto;
69
- max-width: 520px;
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
71
  """
72
 
73
  with gr.Blocks(css=css) as natalie_diffusion:
 
74
  result = gr.Image(label="", show_label=False, elem_id="generated-image")
75
 
76
  with gr.Row():
@@ -110,11 +124,12 @@ Generate images in the surreal style of artist [Natalie Kav](https://www.behance
110
  fn=infer,
111
  inputs=[prompt],
112
  outputs=[result, seed],
113
- cache_examples="lazy"
 
114
  )
115
 
116
  with gr.Column(scale=1, elem_id="right-column"):
117
- result = render()
118
 
119
  gr.on(
120
  triggers=[run_button.click, prompt.submit],
@@ -123,26 +138,5 @@ Generate images in the surreal style of artist [Natalie Kav](https://www.behance
123
  outputs=[result, seed],
124
  )
125
 
126
- css = """
127
- #left-column {
128
- padding: 1rem;
129
- }
130
-
131
- #right-column {
132
- display: flex;
133
- align-items: center;
134
- justify-content: center;
135
- padding: 1rem;
136
- }
137
-
138
- #generated-image > img {
139
- border-radius: 12px;
140
- box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.2);
141
- max-width: 100%;
142
- height: auto;
143
- }
144
- """
145
-
146
-
147
  if __name__ == "__main__":
148
  natalie_diffusion.launch()
 
64
  ]
65
 
66
  css = """
67
+ #left-column {
68
+ padding: 1rem;
69
+ }
70
+
71
+ #right-column {
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: center;
75
+ padding: 1rem;
76
+ }
77
+
78
+ #generated-image > img {
79
+ border-radius: 12px;
80
+ box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.2);
81
+ max-width: 100%;
82
+ height: auto;
83
  }
84
  """
85
 
86
  with gr.Blocks(css=css) as natalie_diffusion:
87
+ # Predefine result image so it's accessible to both sides
88
  result = gr.Image(label="", show_label=False, elem_id="generated-image")
89
 
90
  with gr.Row():
 
124
  fn=infer,
125
  inputs=[prompt],
126
  outputs=[result, seed],
127
+ cache_examples=True,
128
+ cache_mode="lazy"
129
  )
130
 
131
  with gr.Column(scale=1, elem_id="right-column"):
132
+ result.render()
133
 
134
  gr.on(
135
  triggers=[run_button.click, prompt.submit],
 
138
  outputs=[result, seed],
139
  )
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  if __name__ == "__main__":
142
  natalie_diffusion.launch()