mbarnig commited on
Commit
b69875b
·
verified ·
1 Parent(s): 113183f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +63 -1
app.py CHANGED
@@ -73,6 +73,12 @@ def infer(name, pet, background, style, seed=42, randomize_seed=False, width=102
73
  ):
74
  yield img, seed
75
 
 
 
 
 
 
 
76
  css="""
77
  #col-container {
78
  margin: 0 auto;
@@ -122,11 +128,67 @@ with gr.Blocks(css=css) as demo:
122
 
123
  result = gr.Image(label="Result", show_label=False)
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  gr.on(
126
  triggers=[run_button.click, prompt.submit],
127
  fn = infer,
128
  inputs = [prompt, pet, background, style],
129
- outputs = [result]
130
  )
131
 
132
  demo.launch()
 
73
  ):
74
  yield img, seed
75
 
76
+ examples = [
77
+ "a tiny astronaut hatching from an egg on the moon",
78
+ "a cat holding a sign that says hello world",
79
+ "an anime illustration of a wiener schnitzel",
80
+ ]
81
+
82
  css="""
83
  #col-container {
84
  margin: 0 auto;
 
128
 
129
  result = gr.Image(label="Result", show_label=False)
130
 
131
+ with gr.Accordion("Advanced Settings", open=False):
132
+
133
+ seed = gr.Slider(
134
+ label="Seed",
135
+ minimum=0,
136
+ maximum=MAX_SEED,
137
+ step=1,
138
+ value=0,
139
+ )
140
+
141
+ randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
142
+
143
+ with gr.Row():
144
+
145
+ width = gr.Slider(
146
+ label="Width",
147
+ minimum=256,
148
+ maximum=MAX_IMAGE_SIZE,
149
+ step=32,
150
+ value=1024,
151
+ )
152
+
153
+ height = gr.Slider(
154
+ label="Height",
155
+ minimum=256,
156
+ maximum=MAX_IMAGE_SIZE,
157
+ step=32,
158
+ value=1024,
159
+ )
160
+
161
+ with gr.Row():
162
+
163
+ guidance_scale = gr.Slider(
164
+ label="Guidance Scale",
165
+ minimum=1,
166
+ maximum=15,
167
+ step=0.1,
168
+ value=3.5,
169
+ )
170
+
171
+ num_inference_steps = gr.Slider(
172
+ label="Number of inference steps",
173
+ minimum=1,
174
+ maximum=50,
175
+ step=1,
176
+ value=28,
177
+ )
178
+
179
+ gr.Examples(
180
+ examples = examples,
181
+ fn = infer,
182
+ inputs = [prompt],
183
+ outputs = [result, seed],
184
+ cache_examples="lazy"
185
+ )
186
+
187
  gr.on(
188
  triggers=[run_button.click, prompt.submit],
189
  fn = infer,
190
  inputs = [prompt, pet, background, style],
191
+ outputs = [result, seed]
192
  )
193
 
194
  demo.launch()