sagar007 commited on
Commit
cf527f7
·
verified ·
1 Parent(s): 9fd9d70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -21
app.py CHANGED
@@ -225,23 +225,28 @@ HTML_TEMPLATE = """
225
  </div>
226
  """
227
 
228
- # Gradio Interface
229
- with gr.Blocks(css=HTML_TEMPLATE) as demo:
230
- gr.HTML(HTML_TEMPLATE)
231
  with gr.Row():
232
  text = gr.Textbox(label="Prompt", placeholder="Describe your dreamscape...")
233
  style = gr.Dropdown(label="Style", choices=list(style_token_dict.keys()), value="Illustration Style")
 
234
  with gr.Row():
235
  inference_step = gr.Slider(1, 50, 20, step=1, label="Inference steps")
236
  guidance_scale = gr.Slider(1, 10, 7.5, step=0.1, label="Guidance scale")
237
  seed = gr.Slider(0, 10000, 42, step=1, label="Seed")
 
238
  with gr.Row():
239
  guidance_method = gr.Dropdown(label="Guidance method", choices=['Grayscale', 'Bright', 'Contrast', 'Symmetry', 'Saturation'], value="Grayscale")
240
  loss_scale = gr.Slider(100, 10000, 200, step=100, label="Loss scale")
 
241
  with gr.Row():
242
  image_size = gr.Radio(["256x256", "512x512"], label="Image Size", value="256x256")
 
243
  with gr.Row():
244
  generate_button = gr.Button("Create Dreamscape", variant="primary")
 
245
  with gr.Row():
246
  output_image = gr.Image(label="Your Dreamscape")
247
  output_image_guided = gr.Image(label="Guided Dreamscape")
@@ -252,24 +257,18 @@ with gr.Blocks(css=HTML_TEMPLATE) as demo:
252
  outputs=[output_image, output_image_guided]
253
  )
254
 
255
- gr.Markdown("""
256
- Note: Example generation may take some time due to CPU limitations.
257
- Thank you for your patience!
258
- """)
259
-
260
- gr.Examples(
261
- examples=[
262
- ["Floating island with waterfalls", 'Illustration Style', 50, 7.5, 42, 'Grayscale', 200, "256x256"],
263
- ["Futuristic city with neon lights", 'Line Art', 30, 8.0, 123, 'Bright', 300, "256x256"],
264
- ["Japanese garden with cherry blossoms", 'Hitokomoru Style', 40, 7.0, 789, 'Contrast', 250, "256x256"],
265
- ],
266
- inputs=[text, style, inference_step, guidance_scale, seed, guidance_method, loss_scale, image_size],
267
- outputs=[output_image, output_image_guided],
268
- fn=inference,
269
- cache_examples=True,
270
- examples_per_page=5,
271
- cache_timeout=360 # Increase this value (in seconds) as needed
272
-
273
  )
274
 
275
  if __name__ == "__main__":
 
225
  </div>
226
  """
227
 
228
+ with gr.Blocks(css=css) as demo:
229
+ gr.HTML("<div class='header'><h1>🌟 Dreamscape Creator</h1></div>")
230
+
231
  with gr.Row():
232
  text = gr.Textbox(label="Prompt", placeholder="Describe your dreamscape...")
233
  style = gr.Dropdown(label="Style", choices=list(style_token_dict.keys()), value="Illustration Style")
234
+
235
  with gr.Row():
236
  inference_step = gr.Slider(1, 50, 20, step=1, label="Inference steps")
237
  guidance_scale = gr.Slider(1, 10, 7.5, step=0.1, label="Guidance scale")
238
  seed = gr.Slider(0, 10000, 42, step=1, label="Seed")
239
+
240
  with gr.Row():
241
  guidance_method = gr.Dropdown(label="Guidance method", choices=['Grayscale', 'Bright', 'Contrast', 'Symmetry', 'Saturation'], value="Grayscale")
242
  loss_scale = gr.Slider(100, 10000, 200, step=100, label="Loss scale")
243
+
244
  with gr.Row():
245
  image_size = gr.Radio(["256x256", "512x512"], label="Image Size", value="256x256")
246
+
247
  with gr.Row():
248
  generate_button = gr.Button("Create Dreamscape", variant="primary")
249
+
250
  with gr.Row():
251
  output_image = gr.Image(label="Your Dreamscape")
252
  output_image_guided = gr.Image(label="Guided Dreamscape")
 
257
  outputs=[output_image, output_image_guided]
258
  )
259
 
260
+ gr.Examples(
261
+ examples=[
262
+ ["Floating island with waterfalls", 'Illustration Style', 50, 7.5, 42, 'Grayscale', 200, "256x256"],
263
+ ["Futuristic city with neon lights", 'Line Art', 30, 8.0, 123, 'Bright', 300, "256x256"],
264
+ ["Japanese garden with cherry blossoms", 'Hitokomoru Style', 40, 7.0, 789, 'Contrast', 250, "256x256"],
265
+ ],
266
+ inputs=[text, style, inference_step, guidance_scale, seed, guidance_method, loss_scale, image_size],
267
+ outputs=[output_image, output_image_guided],
268
+ fn=inference,
269
+ cache_examples=True,
270
+ examples_per_page=5,
271
+ cache_timeout=360
 
 
 
 
 
 
272
  )
273
 
274
  if __name__ == "__main__":