WatchOutForMike commited on
Commit
e175613
·
1 Parent(s): 6507406

CSS D&D Map update

Browse files
Files changed (1) hide show
  1. app.py +142 -23
app.py CHANGED
@@ -234,6 +234,7 @@ def infer(
234
 
235
  # Example prompts
236
  examples = [
 
237
  ["A heroic adventurer wielding a flaming sword standing on a cliff", "D&D Art"],
238
  ["A mystical library with ancient scrolls and glowing runes", "Dark Fantasy"],
239
  ["A ferocious dragon breathing fire in a dark cavern", "Epic Battle"],
@@ -241,20 +242,137 @@ examples = [
241
 
242
  # Custom CSS for a Dungeons & Dragons theme
243
  css = """
 
244
  body {
245
  background-color: #1b1b1b;
246
  font-family: 'Cinzel', serif;
247
- color: #f4a261;
248
  background-image: url('https://www.transparenttextures.com/patterns/dark-matter.png');
249
  }
 
 
250
  #col-container {
251
  margin: 0 auto;
252
- max-width: 550px;
253
  padding: 15px;
254
  border: 4px solid #8b4513;
255
  background: linear-gradient(145deg, #2e2b2a, #3a3433);
256
  border-radius: 15px;
257
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  }
259
  """
260
 
@@ -264,8 +382,7 @@ with gr.Blocks(css=css) as demo:
264
  # Title and Description
265
  gr.Markdown(
266
  """
267
- # 🛡️ ChatDnD.net 🛡️
268
- # ⚔️ Dungeons & Dragons Image Generator ⚔️
269
  **Unleash Your Imagination!** Create heroes, maps, quests, and epic scenes to bring your campaigns to life.
270
  Tailored for adventurers seeking inspiration or Dungeon Masters constructing their next grand story. <br>
271
  [Visit Our Website](https://chatdnd.net) | [Support Us](https://buymeacoffee.com/watchoutformike)
@@ -281,21 +398,21 @@ with gr.Blocks(css=css) as demo:
281
  )
282
  style = gr.Dropdown(
283
  label="🎨 Select a Style",
284
- choices=STYLE_NAMES,
285
- value=DEFAULT_STYLE_NAME,
286
  )
287
 
288
  # Run button and result display
289
  with gr.Row():
290
- run_button = gr.Button("Generate Image")
291
- result = gr.Image(label="🖼️ Your Legendary Vision")
292
 
293
  # Advanced settings
294
- with gr.Accordion("⚙️ Advanced Settings", open=False):
295
  seed = gr.Slider(
296
  label="Seed",
297
  minimum=0,
298
- maximum=MAX_SEED,
299
  step=1,
300
  value=0,
301
  )
@@ -305,42 +422,44 @@ with gr.Blocks(css=css) as demo:
305
  width = gr.Slider(
306
  label="Width",
307
  minimum=256,
308
- maximum=MAX_IMAGE_SIZE,
309
  step=32,
310
  value=1024,
311
  )
312
  height = gr.Slider(
313
  label="Height",
314
  minimum=256,
315
- maximum=MAX_IMAGE_SIZE,
316
  step=32,
317
- value=1024,
318
  )
319
 
320
- num_inference_steps = gr.Slider(
321
  label="Inference Steps",
322
  minimum=1,
323
  maximum=50,
324
  step=1,
325
- value=4,
326
  )
327
 
328
  # Examples with styles
329
  gr.Examples(
330
- examples=examples,
 
 
 
 
331
  inputs=[prompt, style],
332
  outputs=[result],
333
- fn=infer,
334
- cache_examples="lazy",
335
  )
336
 
337
  # Interactivity
338
  gr.on(
339
  triggers=[run_button.click, prompt.submit],
340
- fn=infer,
341
- inputs=[prompt, style, seed, randomize_seed, width, height, num_inference_steps],
342
- outputs=[result, seed],
343
  )
344
 
345
  # Launch the demo
346
- demo.launch()
 
234
 
235
  # Example prompts
236
  examples = [
237
+ ["A 10x8 battle map located in Ravenloft", "D&D MAP"],
238
  ["A heroic adventurer wielding a flaming sword standing on a cliff", "D&D Art"],
239
  ["A mystical library with ancient scrolls and glowing runes", "Dark Fantasy"],
240
  ["A ferocious dragon breathing fire in a dark cavern", "Epic Battle"],
 
242
 
243
  # Custom CSS for a Dungeons & Dragons theme
244
  css = """
245
+ /* Background settings */
246
  body {
247
  background-color: #1b1b1b;
248
  font-family: 'Cinzel', serif;
249
+ color: #f5f5f5;
250
  background-image: url('https://www.transparenttextures.com/patterns/dark-matter.png');
251
  }
252
+
253
+ /* Main container styling */
254
  #col-container {
255
  margin: 0 auto;
256
+ max-width: 650px;
257
  padding: 15px;
258
  border: 4px solid #8b4513;
259
  background: linear-gradient(145deg, #2e2b2a, #3a3433);
260
  border-radius: 15px;
261
+ box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
262
+ }
263
+
264
+ /* Text styles */
265
+ h1 {
266
+ font-family: 'Cinzel Decorative', serif;
267
+ color: #e9c46a;
268
+ text-shadow: 0 0 10px rgba(233, 196, 106, 0.8);
269
+ font-size: 3em;
270
+ text-align: center;
271
+ }
272
+
273
+ p, label {
274
+ font-family: 'Cormorant', serif;
275
+ font-size: 1.2em;
276
+ color: #e5e5e5;
277
+ }
278
+
279
+ /* Button styling */
280
+ button {
281
+ background-color: #8b4513;
282
+ border: 2px solid #e76f51;
283
+ font-family: 'Cinzel', serif;
284
+ color: #fefae0;
285
+ padding: 10px 20px;
286
+ border-radius: 5px;
287
+ text-transform: uppercase;
288
+ font-weight: bold;
289
+ cursor: pointer;
290
+ transition: 0.3s ease-in-out;
291
+ box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
292
+ }
293
+
294
+ button:hover {
295
+ background-color: #e76f51;
296
+ color: #1b1b1b;
297
+ box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.5);
298
+ transform: scale(1.05);
299
+ }
300
+
301
+ /* Textbox styling */
302
+ textarea, input[type="text"] {
303
+ background-color: #3a3433;
304
+ border: 2px solid #8b4513;
305
+ border-radius: 5px;
306
+ color: #f5f5f5;
307
+ padding: 10px;
308
+ font-size: 1.1em;
309
+ font-family: 'Cormorant', serif;
310
+ width: 100%;
311
+ transition: border-color 0.3s ease-in-out;
312
+ }
313
+
314
+ textarea:hover, input[type="text"]:hover {
315
+ border-color: #e76f51;
316
+ }
317
+
318
+ /* Dropdown styling */
319
+ select {
320
+ background-color: #3a3433;
321
+ color: #f5f5f5;
322
+ border: 2px solid #8b4513;
323
+ padding: 10px;
324
+ border-radius: 5px;
325
+ font-family: 'Cinzel', serif;
326
+ transition: 0.3s ease-in-out;
327
+ }
328
+
329
+ select:hover {
330
+ border-color: #e76f51;
331
+ }
332
+
333
+ /* Accordion styling */
334
+ .accordion {
335
+ background: linear-gradient(145deg, #3a3433, #2e2b2a);
336
+ border-radius: 8px;
337
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
338
+ }
339
+
340
+ /* Image result styling */
341
+ .gr-image-container {
342
+ border: 4px solid #8b4513;
343
+ background: linear-gradient(145deg, #2e2b2a, #3a3433);
344
+ border-radius: 10px;
345
+ margin-top: 15px;
346
+ padding: 5px;
347
+ box-shadow: 0 10px 15px rgba(0, 0, 0, 0.6);
348
+ }
349
+
350
+ /* Interactive hover effects on result images */
351
+ .gr-image-container:hover {
352
+ border-color: #e76f51;
353
+ box-shadow: 0 15px 25px rgba(0, 0, 0, 0.8);
354
+ }
355
+
356
+ /* Progress bar styling */
357
+ .progress-container {
358
+ width: 100%;
359
+ height: 30px;
360
+ background-color: #3a3433;
361
+ border-radius: 15px;
362
+ overflow: hidden;
363
+ margin-bottom: 20px;
364
+ box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
365
+ }
366
+
367
+ .progress-bar {
368
+ height: 100%;
369
+ background-color: #8b4513;
370
+ width: calc(var(--current) / var(--total) * 100%);
371
+ transition: width 0.5s ease-in-out;
372
+ }
373
+
374
+ .progress-bar:hover {
375
+ background-color: #e76f51;
376
  }
377
  """
378
 
 
382
  # Title and Description
383
  gr.Markdown(
384
  """
385
+ # 🛡️ ChatDnD.net D&D Map Generator ⚔️
 
386
  **Unleash Your Imagination!** Create heroes, maps, quests, and epic scenes to bring your campaigns to life.
387
  Tailored for adventurers seeking inspiration or Dungeon Masters constructing their next grand story. <br>
388
  [Visit Our Website](https://chatdnd.net) | [Support Us](https://buymeacoffee.com/watchoutformike)
 
398
  )
399
  style = gr.Dropdown(
400
  label="🎨 Select a Style",
401
+ choices=["Classic Fantasy", "Cartography", "Detailed Lore", "Minimalist Adventure"],
402
+ value="Classic Fantasy",
403
  )
404
 
405
  # Run button and result display
406
  with gr.Row():
407
+ run_button = gr.Button("Generate Map")
408
+ result = gr.Image(label="🗺️ Your Fantasy Map")
409
 
410
  # Advanced settings
411
+ with gr.Accordion("⚙️ Advanced Settings", open=False, elem_id="accordion"):
412
  seed = gr.Slider(
413
  label="Seed",
414
  minimum=0,
415
+ maximum=1000000,
416
  step=1,
417
  value=0,
418
  )
 
422
  width = gr.Slider(
423
  label="Width",
424
  minimum=256,
425
+ maximum=1536,
426
  step=32,
427
  value=1024,
428
  )
429
  height = gr.Slider(
430
  label="Height",
431
  minimum=256,
432
+ maximum=1536,
433
  step=32,
434
+ value=768,
435
  )
436
 
437
+ steps = gr.Slider(
438
  label="Inference Steps",
439
  minimum=1,
440
  maximum=50,
441
  step=1,
442
+ value=20,
443
  )
444
 
445
  # Examples with styles
446
  gr.Examples(
447
+ examples=[
448
+ ["Dragon's Lair, mountain region", "Classic Fantasy"],
449
+ ["Enchanted Forest", "Detailed Lore"],
450
+ ["Ancient Dungeon, lava flows", "Cartography"],
451
+ ],
452
  inputs=[prompt, style],
453
  outputs=[result],
 
 
454
  )
455
 
456
  # Interactivity
457
  gr.on(
458
  triggers=[run_button.click, prompt.submit],
459
+ fn=lambda prompt, style, seed, randomize_seed, width, height, steps: None, # Replace with your actual function
460
+ inputs=[prompt, style, seed, randomize_seed, width, height, steps],
461
+ outputs=[result],
462
  )
463
 
464
  # Launch the demo
465
+ demo.launch()