awacke1 commited on
Commit
86b8f91
·
verified ·
1 Parent(s): 77165a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -40
app.py CHANGED
@@ -132,8 +132,8 @@ def generate(
132
 
133
  return image_paths, seed, download_links, get_image_gallery()
134
 
135
- example_sets = [
136
- [
137
  f"{get_random_style()} painting of a majestic lighthouse on a rocky coast. Use bold brushstrokes and a vibrant color palette to capture the interplay of light and shadow as the lighthouse beam cuts through a stormy night sky.",
138
  f"{get_random_style()} still life featuring a pair of vintage eyeglasses. Focus on the intricate details of the frames and lenses, using a warm color scheme to evoke a sense of nostalgia and wisdom.",
139
  f"{get_random_style()} depiction of a rustic wooden stool in a sunlit artist's studio. Emphasize the texture of the wood and the interplay of light and shadow, using a mix of earthy tones and highlights.",
@@ -144,8 +144,32 @@ example_sets = [
144
  f"{get_random_style()} portrayal of an ancient, mystical gate. Combine architectural details with elements of fantasy, using a rich, jewel-toned palette to create an air of mystery and magic.",
145
  f"{get_random_style()} portrait of a curious cat. Focus on capturing the feline's expressive eyes and sleek form, using a mix of bold and subtle colors to bring out the cat's personality.",
146
  f"{get_random_style()} abstract representation of toes in sand. Use textured brushstrokes to convey the feeling of warm sand, with a palette inspired by a sun-drenched beach."
147
- ] for _ in range(3)
148
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  css = '''
151
  .gradio-container{max-width: 1024px !important}
@@ -223,50 +247,27 @@ with gr.Blocks(css=css, theme="pseudolab/huggingface-korea-theme") as demo:
223
  selected_image = gr.State(None)
224
 
225
  example_set_dropdown = gr.Dropdown(
226
- choices=["Set 1", "Set 2", "Set 3"],
227
  label="Select Example Set",
228
  value="Set 1"
229
  )
230
 
231
- with gr.Group() as example_group:
232
- examples_set1 = gr.Examples(
233
- examples=example_sets[0],
234
- inputs=prompt,
235
- outputs=[result, seed],
236
- fn=generate,
237
- cache_examples=False,
238
- label="Example Set 1"
239
- )
240
- examples_set2 = gr.Examples(
241
- examples=example_sets[1],
242
- inputs=prompt,
243
- outputs=[result, seed],
244
- fn=generate,
245
- cache_examples=False,
246
- label="Example Set 2",
247
- visible=False
248
- )
249
- examples_set3 = gr.Examples(
250
- examples=example_sets[2],
251
- inputs=prompt,
252
- outputs=[result, seed],
253
- fn=generate,
254
- cache_examples=False,
255
- label="Example Set 3",
256
- visible=False
257
- )
258
 
259
- def update_example_visibility(choice):
260
- return (
261
- gr.update(visible=(choice == "Set 1")),
262
- gr.update(visible=(choice == "Set 2")),
263
- gr.update(visible=(choice == "Set 3"))
264
- )
265
 
266
  example_set_dropdown.change(
267
- fn=update_example_visibility,
268
  inputs=[example_set_dropdown],
269
- outputs=[examples_set1, examples_set2, examples_set3]
270
  )
271
 
272
  use_negative_prompt.change(
 
132
 
133
  return image_paths, seed, download_links, get_image_gallery()
134
 
135
+ example_sets = {
136
+ "Set 1": [
137
  f"{get_random_style()} painting of a majestic lighthouse on a rocky coast. Use bold brushstrokes and a vibrant color palette to capture the interplay of light and shadow as the lighthouse beam cuts through a stormy night sky.",
138
  f"{get_random_style()} still life featuring a pair of vintage eyeglasses. Focus on the intricate details of the frames and lenses, using a warm color scheme to evoke a sense of nostalgia and wisdom.",
139
  f"{get_random_style()} depiction of a rustic wooden stool in a sunlit artist's studio. Emphasize the texture of the wood and the interplay of light and shadow, using a mix of earthy tones and highlights.",
 
144
  f"{get_random_style()} portrayal of an ancient, mystical gate. Combine architectural details with elements of fantasy, using a rich, jewel-toned palette to create an air of mystery and magic.",
145
  f"{get_random_style()} portrait of a curious cat. Focus on capturing the feline's expressive eyes and sleek form, using a mix of bold and subtle colors to bring out the cat's personality.",
146
  f"{get_random_style()} abstract representation of toes in sand. Use textured brushstrokes to convey the feeling of warm sand, with a palette inspired by a sun-drenched beach."
147
+ ],
148
+ "Set 2": [
149
+ f"{get_random_style()} painting of a majestic lighthouse on a rocky coast. Use bold brushstrokes and a vibrant color palette to capture the interplay of light and shadow as the lighthouse beam cuts through a stormy night sky.",
150
+ f"{get_random_style()} still life featuring a pair of vintage eyeglasses. Focus on the intricate details of the frames and lenses, using a warm color scheme to evoke a sense of nostalgia and wisdom.",
151
+ f"{get_random_style()} depiction of a rustic wooden stool in a sunlit artist's studio. Emphasize the texture of the wood and the interplay of light and shadow, using a mix of earthy tones and highlights.",
152
+ f"{get_random_style()} scene viewed through an ornate window frame. Contrast the intricate details of the window with a dreamy, soft-focus landscape beyond, using a palette that transitions from cool interior tones to warm exterior hues.",
153
+ f"{get_random_style()} close-up study of interlaced fingers. Use a monochromatic color scheme to emphasize the form and texture of the hands, with dramatic lighting to create depth and emotion.",
154
+ f"{get_random_style()} composition featuring a set of dice in motion. Capture the energy and randomness of the throw, using a dynamic color palette and blurred lines to convey movement.",
155
+ f"{get_random_style()} interpretation of heaven. Create an ethereal atmosphere with soft, billowing clouds and radiant light, using a palette of celestial blues, golds, and whites.",
156
+ f"{get_random_style()} portrayal of an ancient, mystical gate. Combine architectural details with elements of fantasy, using a rich, jewel-toned palette to create an air of mystery and magic.",
157
+ f"{get_random_style()} portrait of a curious cat. Focus on capturing the feline's expressive eyes and sleek form, using a mix of bold and subtle colors to bring out the cat's personality.",
158
+ f"{get_random_style()} abstract representation of toes in sand. Use textured brushstrokes to convey the feeling of warm sand, with a palette inspired by a sun-drenched beach."
159
+ ],
160
+ "Set 3": [
161
+ f"{get_random_style()} painting of a majestic lighthouse on a rocky coast. Use bold brushstrokes and a vibrant color palette to capture the interplay of light and shadow as the lighthouse beam cuts through a stormy night sky.",
162
+ f"{get_random_style()} still life featuring a pair of vintage eyeglasses. Focus on the intricate details of the frames and lenses, using a warm color scheme to evoke a sense of nostalgia and wisdom.",
163
+ f"{get_random_style()} depiction of a rustic wooden stool in a sunlit artist's studio. Emphasize the texture of the wood and the interplay of light and shadow, using a mix of earthy tones and highlights.",
164
+ f"{get_random_style()} scene viewed through an ornate window frame. Contrast the intricate details of the window with a dreamy, soft-focus landscape beyond, using a palette that transitions from cool interior tones to warm exterior hues.",
165
+ f"{get_random_style()} close-up study of interlaced fingers. Use a monochromatic color scheme to emphasize the form and texture of the hands, with dramatic lighting to create depth and emotion.",
166
+ f"{get_random_style()} composition featuring a set of dice in motion. Capture the energy and randomness of the throw, using a dynamic color palette and blurred lines to convey movement.",
167
+ f"{get_random_style()} interpretation of heaven. Create an ethereal atmosphere with soft, billowing clouds and radiant light, using a palette of celestial blues, golds, and whites.",
168
+ f"{get_random_style()} portrayal of an ancient, mystical gate. Combine architectural details with elements of fantasy, using a rich, jewel-toned palette to create an air of mystery and magic.",
169
+ f"{get_random_style()} portrait of a curious cat. Focus on capturing the feline's expressive eyes and sleek form, using a mix of bold and subtle colors to bring out the cat's personality.",
170
+ f"{get_random_style()} abstract representation of toes in sand. Use textured brushstrokes to convey the feeling of warm sand, with a palette inspired by a sun-drenched beach."
171
+ ]
172
+ }
173
 
174
  css = '''
175
  .gradio-container{max-width: 1024px !important}
 
247
  selected_image = gr.State(None)
248
 
249
  example_set_dropdown = gr.Dropdown(
250
+ choices=list(example_sets.keys()),
251
  label="Select Example Set",
252
  value="Set 1"
253
  )
254
 
255
+ examples = gr.Examples(
256
+ examples=example_sets["Set 1"],
257
+ inputs=prompt,
258
+ outputs=[result, seed],
259
+ fn=generate,
260
+ cache_examples=False,
261
+ label="Example Set"
262
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
+ def update_examples(choice):
265
+ return gr.Examples.update(examples=example_sets[choice])
 
 
 
 
266
 
267
  example_set_dropdown.change(
268
+ fn=update_examples,
269
  inputs=[example_set_dropdown],
270
+ outputs=[examples]
271
  )
272
 
273
  use_negative_prompt.change(