drakosfire commited on
Commit
d5995af
1 Parent(s): 580133f

added gallery folder structure, with examples, added example tabs to app.py

Browse files
__pycache__/app.cpython-310.pyc CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
 
__pycache__/description_helper.cpython-310.pyc CHANGED
Binary files a/__pycache__/description_helper.cpython-310.pyc and b/__pycache__/description_helper.cpython-310.pyc differ
 
__pycache__/utilities.cpython-310.pyc CHANGED
Binary files a/__pycache__/utilities.cpython-310.pyc and b/__pycache__/utilities.cpython-310.pyc differ
 
app.py CHANGED
@@ -16,6 +16,14 @@ M_MMAP_THRESHOLD = -3
16
  # Set malloc mmap threshold.
17
  libc.mallopt(M_MMAP_THRESHOLD, 2**20)
18
 
 
 
 
 
 
 
 
 
19
  style_css = custom_css = """
20
  <link href='file=/media/drakosfire/Shared/Docker/StatblockGenerator/dependencies/all.css' rel='stylesheet' />
21
  <link href='file=/media/drakosfire/Shared/Docker/StatblockGenerator/dependencies/css.css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css' />
@@ -273,32 +281,37 @@ with gr.Blocks(css = "style.css") as demo:
273
  iframe = iframe = f"""<iframe src="file={mon_file_path}" width="100%" height="500px"></iframe>"""
274
  link = f'<a href="file={mon_file_path}" target="_blank">{u.file_name_list[1] +".html"}</a>'
275
  return iframe
276
-
277
- gr.HTML(""" <div id="inner"> <header>
278
- <h1>Monster Statblock Generator</h1>
279
- <p>
280
- With this AI driven tool you will build a collectible style card of a fantasy flavored item with details.
281
- </p>
282
- </div>""")
283
-
284
- markdown_instructions = """## How It Works
285
- This tool is a fun way to quickly generate Dungeons and Dragons monster manual style statblocks with art and a token for a Virtual Table Top. \n
286
- 1. Your intitial text along with the prompt is sent to GPT 4o to generate all the values for a Dungeons and Dragons creature. \n
287
- a. Include as much or as little information as you'd like. \n
288
- b. Just a name : The Flavor Lich \n
289
- c. A bit of detail : A friendly skeletal lich who is a master of flavor, called The Flavor Lich \n
290
- d. Lots of detail : A friendly skeletal lich who is a master of flavor, called The Flavor Lich, the Lich is Challenge Rating 8 and is a 4th level spell caster whose spells are all about food. \n
291
- 2. The results will populate below in editable fields that are saved on edit. \n
292
- 3. Review the results, make any changes you'd like. \n
293
- ## The first image generation take about 2 minutes to 'warm up' after that it's ~10s per image. \n
294
- \n
295
- **Image and Text Generation**: Now you can generate 4 images for the statblock page without text and pick your favorite. \n
296
- 4. Click 'Generate Statblock Art' and wait for the images to generate, then select the one you'd like to use. \n
297
- 5. Click 'Generate HTML' to generate a webpage that can be saved or printed as PDF. \n
298
- 6. Last, you can generate a token or figure of your creature or a 3d model to download. \n
299
- """
300
 
301
- gr.Markdown(markdown_instructions)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  with gr.Tab("Generator"):
303
 
304
  with gr.Row():
@@ -311,30 +324,63 @@ This tool is a fun way to quickly generate Dungeons and Dragons monster manual s
311
  spells_checkbox = gr.Checkbox(label= "Spellcaster?")
312
  legendary_action_checkbox = gr.Checkbox(label= "Legendary Actions?")
313
 
314
- desc_gen = gr.Button(value = "Step 2 : Generate Description")
315
 
316
- mon_description_output = gr.Textbox(label = 'Description', lines = 2, interactive=True)
 
 
 
317
 
318
 
319
  with gr.Row():
320
  with gr.Column(scale = 1):
321
- mon_name_output = gr.Textbox(label = 'Name', lines = 1, interactive=True)
322
- mon_size_output = gr.Textbox(label = 'Size', lines = 1, interactive=True)
323
- mon_alignment_output = gr.Textbox(label = 'Alignment', lines = 1, interactive=True)
324
- mon_armor_class_output = gr.Textbox(label = 'Armor Class', lines = 1, interactive=True)
325
- mon_hit_dice_output = gr.Textbox(label = 'Hit Dice', lines = 1, interactive=True)
326
- mon_senses_output = gr.Textbox(label = 'Senses', lines = 1, interactive=True)
327
- mon_actions_output = gr.Textbox(label = 'Actions', lines = 16, interactive=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
 
329
  with gr.Column(scale = 1):
330
- mon_type_output = gr.Textbox(label = 'Type', lines = 1, interactive=True)
331
- mon_speed_output = gr.Textbox(label = 'Speed', lines = 1, interactive=True)
332
- mon_abilities_output = gr.Textbox(label ='Ability Scores', lines = 5, interactive=True)
 
 
 
 
 
 
 
 
 
333
  mon_damage_resistance_output = gr.Textbox(label = 'Damage Resistance', lines = 1, interactive=True, visible=False)
334
  mon_damage_resistance_output.change(fn=update_visibility,
335
  inputs=[mon_damage_resistance_output],
336
  outputs=[mon_damage_resistance_output])
337
- mon_challenge_rating_output = gr.Textbox(label = 'Challenge Rating', lines = 1, interactive=True)
338
  mon_cantrips_output = gr.Textbox(label = 'Cantrips', lines = 16, interactive=True, visible=False)
339
  mon_cantrips_output.change(fn=update_visibility,
340
  inputs=[mon_cantrips_output],
@@ -353,27 +399,48 @@ This tool is a fun way to quickly generate Dungeons and Dragons monster manual s
353
  mon_subtype_output.change(fn=update_visibility,
354
  inputs=[mon_subtype_output],
355
  outputs=[mon_subtype_output])
356
- mon_saving_throws_output = gr.Textbox(label = 'Saving Throws', lines = 1, interactive=True)
357
- mon_skills_output = gr.Textbox(label = 'Skills', lines = 1, interactive=True)
358
- mon_hp_output = gr.Textbox(label = 'Health Points', lines = 1, interactive=True)
359
- mon_languages_output = gr.Textbox(label = 'Languages', lines = 1, interactive=True)
360
- mon_xp_output = gr.Textbox(label = 'XP', lines = 1, interactive=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  mon_legendary_actions_output = gr.Textbox(label = 'Legendary Actions', lines = 16, interactive=True, visible = False)
362
  mon_legendary_actions_output.change(fn = update_visibility,
363
  inputs =[mon_legendary_actions_output],
364
  outputs=[mon_legendary_actions_output])
365
-
366
-
367
-
368
-
369
-
370
-
371
 
372
- mon_sd_prompt_output = gr.Textbox(label = 'Image Generation Prompt', lines = 1, interactive=True)
 
 
 
 
 
 
 
 
 
 
 
 
373
 
374
  with gr.Row():
375
  with gr.Column():
376
- image_gen = gr.Button(value = "Generate Art for the statblock" )
377
  mon_image_gallery = gr.Gallery(label = "Generated Images",
378
  show_label = True,
379
  elem_id = "gallery",
@@ -390,8 +457,8 @@ This tool is a fun way to quickly generate Dungeons and Dragons monster manual s
390
  object_fit = "cover",
391
  height ="auto")
392
  model_gen_instructions = """## Generate a 3d model
393
- Create a 3d model with texture using your selected image from the Generated Images Gallery \n
394
- 1. Select your favorite image.
395
  *Works best with images without thin qualities, like antenna \n
396
  2. Click Generate a 3d model button.
397
  3. Wait about 30 seconds, then review and download as an .glb file.
@@ -415,74 +482,117 @@ Create a 3d model with texture using your selected image from the Generated Imag
415
  mon_image_gallery.select(fn = assign_img_path, outputs=selected_generated_image)
416
  mon_token_gallery.select(fn = assign_img_path, outputs=selected_token_image)
417
 
418
- desc_gen.click(fn = gen_mon_desc, inputs = [user_mon_description,spells_checkbox, legendary_action_checkbox],
419
- outputs= [mon_name, mon_name_output,
420
- mon_size,mon_size_output,
421
- mon_type,mon_type_output,
422
- mon_subtype,mon_subtype_output,
423
- mon_alignment, mon_alignment_output,
424
- mon_armor_class, mon_armor_class_output,
425
- mon_hp, mon_hp_output,
426
- mon_hit_dice, mon_hit_dice_output,
427
- mon_speed, mon_speed_output,
428
- mon_abilities, mon_abilities_output,
429
- mon_saving_throws, mon_saving_throws_output,
430
- mon_skills, mon_skills_output,
431
- mon_damage_resistance, mon_damage_resistance_output,
432
- mon_senses, mon_senses_output,
433
- mon_languages, mon_languages_output,
434
- mon_challenge_rating, mon_challenge_rating_output,
435
- mon_xp, mon_xp_output,
436
- mon_actions, mon_actions_output,
437
- mon_cantrips,mon_cantrips_output,
438
- mon_spells, mon_spells_output,
439
- mon_spell_slots, mon_spell_slot_output,
440
- mon_legendary_actions, mon_legendary_actions_output,
441
- mon_description, mon_description_output,
442
- mon_sd_prompt,mon_sd_prompt_output
443
-
444
- ])
 
445
 
446
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
 
448
- # Build buttons to modify to html and show html
449
- gen_html = gr.Button(value = "Step 3 : Generate html")
450
- html = gr.HTML(label="HTML preview", show_label=True)
451
- gen_html.click(build_html_file,inputs =[
452
- mon_name_output,
453
- mon_size_output,
454
- mon_type_output,
455
- mon_subtype_output,
456
- mon_alignment_output,
457
- mon_armor_class_output,
458
- mon_hp_output,
459
- mon_hit_dice_output,
460
- mon_speed_output,
461
- mon_abilities_output,
462
- mon_saving_throws_output,
463
- mon_skills_output,
464
- mon_damage_resistance_output,
465
- mon_senses_output,
466
- mon_languages_output,
467
- mon_challenge_rating_output,
468
- mon_xp_output,
469
- mon_actions_output,
470
- mon_description_output,
471
- selected_generated_image,
472
- mon_cantrips_output,
473
- mon_spells_output,
474
- mon_spell_slot_output,
475
- mon_legendary_actions_output,
476
-
477
- ],
478
- outputs= html
479
- )
480
 
481
- base_dir = os.path.dirname(os.path.abspath(__file__)) # Gets the directory where the script is located
482
- print(f"Base Directory :",base_dir)
483
- list_of_static_dir = [os.path.join(base_dir, "output"),
484
- os.path.join(base_dir, "dependencies")]
485
- gr.set_static_paths(paths=list_of_static_dir)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
 
487
 
488
  if __name__ == "__main__":
 
16
  # Set malloc mmap threshold.
17
  libc.mallopt(M_MMAP_THRESHOLD, 2**20)
18
 
19
+ # Declare accessible directories
20
+ base_dir = os.path.dirname(os.path.abspath(__file__)) # Gets the directory where the script is located
21
+ print(f"Base Directory :",base_dir)
22
+ list_of_static_dir = [os.path.join(base_dir, "output"),
23
+ os.path.join(base_dir, "dependencies"),
24
+ os.path.join(base_dir, "galleries/examples/statblocks")]
25
+ gr.set_static_paths(paths=list_of_static_dir)
26
+
27
  style_css = custom_css = """
28
  <link href='file=/media/drakosfire/Shared/Docker/StatblockGenerator/dependencies/all.css' rel='stylesheet' />
29
  <link href='file=/media/drakosfire/Shared/Docker/StatblockGenerator/dependencies/css.css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css' />
 
281
  iframe = iframe = f"""<iframe src="file={mon_file_path}" width="100%" height="500px"></iframe>"""
282
  link = f'<a href="file={mon_file_path}" target="_blank">{u.file_name_list[1] +".html"}</a>'
283
  return iframe
284
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
 
286
+ with gr.Tab("Instructions"):
287
+ gr.HTML(""" <div id="inner"> <header>
288
+ <h1>Monster Statblock Generator</h1>
289
+ <p>
290
+ With this AI driven tool you will build a collectible style card of a fantasy flavored item with details.
291
+ </p>
292
+ </div>""")
293
+
294
+ markdown_instructions = """## How It Works
295
+ This tool is a fun way to quickly generate Dungeons and Dragons monster manual style statblocks with art and a token for a Virtual Table Top. \n
296
+ 1. Your intitial text along with the prompt is sent to GPT 4o to generate all the values for a Dungeons and Dragons creature. \n
297
+ a. Include as much or as little information as you'd like. \n
298
+ b. Just a name : The Flavor Lich \n
299
+ c. A bit of detail : A friendly skeletal lich who is a master of flavor, called The Flavor Lich \n
300
+ d. Lots of detail : A friendly skeletal lich who is a master of flavor, called The Flavor Lich, the Lich is Challenge Rating 8 and is a 4th level spell caster whose spells are all about food. \n
301
+ 2. The results will populate below in editable fields that are saved on edit. \n
302
+ 3. Review the results, make any changes you'd like. \n
303
+ ## The first image generation take about 2 minutes to 'warm up' after that it's ~10s per image. \n
304
+ \n
305
+ **Image and Text Generation**: Now you can generate 4 images for the statblock page without text and pick your favorite. \n
306
+ 4. Click 'Generate Statblock Art' and wait for the images to generate, then select the one you'd like to use. \n
307
+ 5. Click 'Generate HTML' to generate a webpage that can be saved or printed as PDF. \n
308
+ 6. Last, you can generate a token or figure of your creature or a 3d model to download. \n
309
+ """
310
+ gr.Markdown(markdown_instructions)
311
+
312
+
313
+
314
+
315
  with gr.Tab("Generator"):
316
 
317
  with gr.Row():
 
324
  spells_checkbox = gr.Checkbox(label= "Spellcaster?")
325
  legendary_action_checkbox = gr.Checkbox(label= "Legendary Actions?")
326
 
327
+ desc_gen = gr.Button(value = "Click to Generate Description")
328
 
329
+ mon_description_output = gr.Textbox(label = 'Description', lines = 2, interactive=True, visible=False)
330
+ mon_description_output.change(fn=update_visibility,
331
+ inputs=[mon_description_output],
332
+ outputs=[mon_description_output])
333
 
334
 
335
  with gr.Row():
336
  with gr.Column(scale = 1):
337
+ mon_name_output = gr.Textbox(label = 'Name', lines = 1, interactive=True, visible=False)
338
+ mon_name_output.change(fn=update_visibility,
339
+ inputs=[mon_name_output],
340
+ outputs=[mon_name_output])
341
+ mon_size_output = gr.Textbox(label = 'Size', lines = 1, interactive=True, visible=False)
342
+ mon_size_output.change(fn=update_visibility,
343
+ inputs=[mon_size_output],
344
+ outputs=[mon_size_output])
345
+ mon_alignment_output = gr.Textbox(label = 'Alignment', lines = 1, interactive=True, visible=False)
346
+ mon_alignment_output.change(fn=update_visibility,
347
+ inputs=[mon_alignment_output],
348
+ outputs=[mon_alignment_output])
349
+ mon_armor_class_output = gr.Textbox(label = 'Armor Class', lines = 1, interactive=True, visible=False)
350
+ mon_armor_class_output.change(fn=update_visibility,
351
+ inputs=[mon_armor_class_output],
352
+ outputs=[mon_armor_class_output])
353
+ mon_hit_dice_output = gr.Textbox(label = 'Hit Dice', lines = 1, interactive=True, visible=False)
354
+ mon_hit_dice_output.change(fn=update_visibility,
355
+ inputs=[mon_hit_dice_output],
356
+ outputs=[mon_hit_dice_output])
357
+ mon_senses_output = gr.Textbox(label = 'Senses', lines = 1, interactive=True, visible =False)
358
+ mon_senses_output.change(fn=update_visibility,
359
+ inputs=[mon_senses_output],
360
+ outputs=[mon_senses_output])
361
+ mon_actions_output = gr.Textbox(label = 'Actions', lines = 16, interactive=True, visible = False)
362
+ mon_actions_output.change(fn=update_visibility,
363
+ inputs=[mon_actions_output],
364
+ outputs=[mon_actions_output])
365
 
366
  with gr.Column(scale = 1):
367
+ mon_type_output = gr.Textbox(label = 'Type', lines = 1, interactive=True, visible=False)
368
+ mon_actions_output.change(fn=update_visibility,
369
+ inputs=[mon_actions_output],
370
+ outputs=[mon_actions_output])
371
+ mon_speed_output = gr.Textbox(label = 'Speed', lines = 1, interactive=True, visible=False)
372
+ mon_speed_output.change(fn=update_visibility,
373
+ inputs=[mon_speed_output],
374
+ outputs=[mon_speed_output])
375
+ mon_abilities_output = gr.Textbox(label ='Ability Scores', lines = 5, interactive=True, visible=False)
376
+ mon_abilities_output.change(fn=update_visibility,
377
+ inputs=[mon_abilities_output],
378
+ outputs=[mon_abilities_output])
379
  mon_damage_resistance_output = gr.Textbox(label = 'Damage Resistance', lines = 1, interactive=True, visible=False)
380
  mon_damage_resistance_output.change(fn=update_visibility,
381
  inputs=[mon_damage_resistance_output],
382
  outputs=[mon_damage_resistance_output])
383
+ mon_challenge_rating_output = gr.Textbox(label = 'Challenge Rating', lines = 1, interactive=True, visible=False)
384
  mon_cantrips_output = gr.Textbox(label = 'Cantrips', lines = 16, interactive=True, visible=False)
385
  mon_cantrips_output.change(fn=update_visibility,
386
  inputs=[mon_cantrips_output],
 
399
  mon_subtype_output.change(fn=update_visibility,
400
  inputs=[mon_subtype_output],
401
  outputs=[mon_subtype_output])
402
+ mon_saving_throws_output = gr.Textbox(label = 'Saving Throws', lines = 1, interactive=True, visible=False)
403
+ mon_saving_throws_output.change(fn=update_visibility,
404
+ inputs=[mon_saving_throws_output],
405
+ outputs=[mon_saving_throws_output])
406
+ mon_skills_output = gr.Textbox(label = 'Skills', lines = 1, interactive=True, visible=False)
407
+ mon_skills_output.change(fn=update_visibility,
408
+ inputs=[mon_skills_output],
409
+ outputs=[mon_skills_output])
410
+ mon_hp_output = gr.Textbox(label = 'Health Points', lines = 1, interactive=True, visible=False)
411
+ mon_hp_output.change(fn=update_visibility,
412
+ inputs=[mon_hp_output],
413
+ outputs=[mon_hp_output])
414
+ mon_languages_output = gr.Textbox(label = 'Languages', lines = 1, interactive=True, visible=False)
415
+ mon_languages_output.change(fn=update_visibility,
416
+ inputs=[mon_languages_output],
417
+ outputs=[mon_languages_output])
418
+ mon_xp_output = gr.Textbox(label = 'XP', lines = 1, interactive=True, visible=False)
419
+ mon_xp_output.change(fn=update_visibility,
420
+ inputs=[mon_xp_output],
421
+ outputs=[mon_xp_output])
422
  mon_legendary_actions_output = gr.Textbox(label = 'Legendary Actions', lines = 16, interactive=True, visible = False)
423
  mon_legendary_actions_output.change(fn = update_visibility,
424
  inputs =[mon_legendary_actions_output],
425
  outputs=[mon_legendary_actions_output])
 
 
 
 
 
 
426
 
427
+ mon_sd_prompt_output = gr.Textbox(label = 'Image Generation Prompt', lines = 1, interactive=True, visible=False)
428
+ mon_sd_prompt_output.change(fn=update_visibility,
429
+ inputs=[mon_sd_prompt_output],
430
+ outputs=[mon_sd_prompt_output])
431
+ image_gen_instructions = """ ## Image Generation \n
432
+ 1. Review the text in the 'Image Generation Prompt' Textbox\n
433
+ 2. Click 'Generate Statblock Art' \n
434
+ 3. This will take 2 minutes for the first image, then about 10 seconds each. \n
435
+ ** *Additional generation will take about 10 seconds each, until the server goes to sleep ~3 minutes inactivity. \n
436
+ 4. Click your favorite of the four images, this loads it for the page builder and 3d model generator.
437
+ """
438
+
439
+ gr.Markdown(image_gen_instructions)
440
 
441
  with gr.Row():
442
  with gr.Column():
443
+ image_gen = gr.Button(value = "Generate Statblock Art" )
444
  mon_image_gallery = gr.Gallery(label = "Generated Images",
445
  show_label = True,
446
  elem_id = "gallery",
 
457
  object_fit = "cover",
458
  height ="auto")
459
  model_gen_instructions = """## Generate a 3d model
460
+
461
+ 1. Make sure an image was clicked in the "Generated Images" gallery.
462
  *Works best with images without thin qualities, like antenna \n
463
  2. Click Generate a 3d model button.
464
  3. Wait about 30 seconds, then review and download as an .glb file.
 
482
  mon_image_gallery.select(fn = assign_img_path, outputs=selected_generated_image)
483
  mon_token_gallery.select(fn = assign_img_path, outputs=selected_token_image)
484
 
485
+ desc_gen.click(fn = gen_mon_desc, inputs = [user_mon_description,spells_checkbox, legendary_action_checkbox],
486
+ outputs= [mon_name, mon_name_output,
487
+ mon_size,mon_size_output,
488
+ mon_type,mon_type_output,
489
+ mon_subtype,mon_subtype_output,
490
+ mon_alignment, mon_alignment_output,
491
+ mon_armor_class, mon_armor_class_output,
492
+ mon_hp, mon_hp_output,
493
+ mon_hit_dice, mon_hit_dice_output,
494
+ mon_speed, mon_speed_output,
495
+ mon_abilities, mon_abilities_output,
496
+ mon_saving_throws, mon_saving_throws_output,
497
+ mon_skills, mon_skills_output,
498
+ mon_damage_resistance, mon_damage_resistance_output,
499
+ mon_senses, mon_senses_output,
500
+ mon_languages, mon_languages_output,
501
+ mon_challenge_rating, mon_challenge_rating_output,
502
+ mon_xp, mon_xp_output,
503
+ mon_actions, mon_actions_output,
504
+ mon_cantrips,mon_cantrips_output,
505
+ mon_spells, mon_spells_output,
506
+ mon_spell_slots, mon_spell_slot_output,
507
+ mon_legendary_actions, mon_legendary_actions_output,
508
+ mon_description, mon_description_output,
509
+ mon_sd_prompt,mon_sd_prompt_output
510
+
511
+ ])
512
+
513
 
514
+
515
+ # Build buttons to modify to html and show html
516
+ gen_html = gr.Button(value = "Step 3 : Generate html")
517
+ html = gr.HTML(label="HTML preview", show_label=True)
518
+ gen_html.click(build_html_file,inputs =[
519
+ mon_name_output,
520
+ mon_size_output,
521
+ mon_type_output,
522
+ mon_subtype_output,
523
+ mon_alignment_output,
524
+ mon_armor_class_output,
525
+ mon_hp_output,
526
+ mon_hit_dice_output,
527
+ mon_speed_output,
528
+ mon_abilities_output,
529
+ mon_saving_throws_output,
530
+ mon_skills_output,
531
+ mon_damage_resistance_output,
532
+ mon_senses_output,
533
+ mon_languages_output,
534
+ mon_challenge_rating_output,
535
+ mon_xp_output,
536
+ mon_actions_output,
537
+ mon_description_output,
538
+ selected_generated_image,
539
+ mon_cantrips_output,
540
+ mon_spells_output,
541
+ mon_spell_slot_output,
542
+ mon_legendary_actions_output,
543
+
544
+ ],
545
+ outputs= html
546
+ )
547
+
548
+ example_headers = ['## Statblock Examples',
549
+ '## Token Examples',
550
+ '## 3D Model Examples']
551
+ with gr.Tab("Statblock Examples"):
552
 
553
+ gr.Markdown(example_headers[0])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
 
555
+ examples = u.absolute_path("./galleries/examples/statblocks")
556
+
557
+ example_gallery = gr.Gallery(label = "Statblock Examples",
558
+ show_label = True,
559
+ elem_id = "gallery",
560
+ columns =[4], rows =[1],
561
+ object_fit = "fill",
562
+ height = 768,
563
+ value = examples)
564
+ with gr.Tab("Token Examples"):
565
+ example_headers = ['## Statblock Examples',
566
+ '## Token Examples',
567
+ '## 3D Model Examples']
568
+ gr.Markdown(example_headers[1])
569
+
570
+ examples = u.absolute_path("./galleries/examples/tokens")
571
+
572
+ example_gallery = gr.Gallery(label = "Token Examples",
573
+ show_label = True,
574
+ elem_id = "gallery",
575
+ columns =[4], rows =[1],
576
+ object_fit = "fill",
577
+ height = 768,
578
+ value = examples)
579
+ with gr.Tab("3d Model Examples"):
580
+ example_headers = ['## Statblock Examples',
581
+ '## Token Examples',
582
+ '## 3D Model Examples']
583
+ gr.Markdown(example_headers[2])
584
+
585
+ examples = u.absolute_path("./galleries/examples/models")
586
+ with gr.Row():
587
+ example_gallery = gr.Model3D(label = "3d Model Examples",
588
+ show_label = True,
589
+
590
+
591
+ value = examples[0])
592
+ example_gallery = gr.Model3D(label = "3d Model Examples",
593
+ show_label = True,
594
+
595
+ value = examples[1])
596
 
597
 
598
  if __name__ == "__main__":
description_helper.py CHANGED
@@ -95,7 +95,7 @@ def convert_to_dict(string):
95
 
96
  # Instructions past 4 are not time tested and may need to be removed.
97
  ### Meta prompted :
98
- prompt_instructions = """ **Purpose**: ONLY Generate a structured json following the provided format. The job is to generate a balance, creative, interesting monster statblock in the rule style of Dungeons and Dragons. You do not need to stick strictly to the abilities and spells of the game, if it fits the style and flavor of the user input, get weird, scary, or silly with the details. You will also be writing a paragraph of interesting flavor text and description, and a brief one sentence image generation prompt.Include the type and subtype in the image prompt.
99
 
100
  Image Generation Prompt Examples :
101
  "A hooded stout dwarf necromancer, in black robes, emanating evil magic "
 
95
 
96
  # Instructions past 4 are not time tested and may need to be removed.
97
  ### Meta prompted :
98
+ prompt_instructions = """ **Purpose**: ONLY Generate a structured json following the provided format. The job is to generate a balance, creative, interesting monster statblock in the rule style of Dungeons and Dragons. You do not need to stick strictly to the abilities and spells of the game, if it fits the style and flavor of the user input, get weird, scary, or silly with the details. You will also be writing a paragraph of interesting flavor text and description, and a brief one sentence image generation prompt.Include the type and subtype in the image prompt. Us a wide range of words, you have certain words you use too often, avoid them ex : "whimsical", "unwavering"
99
 
100
  Image Generation Prompt Examples :
101
  "A hooded stout dwarf necromancer, in black robes, emanating evil magic "
galleries/examples/statblocks/Screenshot from 2024-06-19 21-12-00.png ADDED

Git LFS Details

  • SHA256: a25dc174f6fb2500f150de32992b4ad1c86189fada9692d173f2c2e44473f69a
  • Pointer size: 132 Bytes
  • Size of remote file: 1.29 MB
galleries/examples/statblocks/muaddib.png ADDED

Git LFS Details

  • SHA256: 69e25f38bd09a82ae5816dead00813f1c3004dbbb51c77993eebb369cd55e148
  • Pointer size: 131 Bytes
  • Size of remote file: 430 kB
galleries/examples/statblocks/tiefling_cultist_statblock.png ADDED

Git LFS Details

  • SHA256: 9bae453797c60a0e125bec630faff5ff379bcbd2a8c6fac2a19e2cc611942d6b
  • Pointer size: 131 Bytes
  • Size of remote file: 665 kB
galleries/examples/tokens/Barnaby_the_Laundry_Gnome_token.png ADDED

Git LFS Details

  • SHA256: 2a269cdcbd30c87f381efe6f366a7d51b490740c6fc07b585392a3d689865d8e
  • Pointer size: 131 Bytes
  • Size of remote file: 805 kB
galleries/examples/tokens/BatleGoat2.png ADDED

Git LFS Details

  • SHA256: a91a49a23553fc796fd6c84434f684ffac28cfd113f20c9d3b63b66b76fb5fc6
  • Pointer size: 132 Bytes
  • Size of remote file: 1.27 MB
galleries/examples/tokens/DwarfMage.png ADDED

Git LFS Details

  • SHA256: 5125f16570c4f1937f9b9d4cb40afad102d5d366e5f7f8fa8798ed6297ae08ae
  • Pointer size: 131 Bytes
  • Size of remote file: 960 kB
galleries/examples/tokens/TabaxiReporter.png ADDED

Git LFS Details

  • SHA256: d9c0d11d3c7a6084a6b4008ea0be52b3712081bf2ca8519b42c95772b7b9b72e
  • Pointer size: 131 Bytes
  • Size of remote file: 800 kB
galleries/examples/tokens/tiefling_cultist.png ADDED

Git LFS Details

  • SHA256: fd1e5151a2d4b75d95b91dd5314aa0174ad5463c2da75208471fcf50194c9f61
  • Pointer size: 131 Bytes
  • Size of remote file: 741 kB
utilities.py CHANGED
@@ -89,6 +89,17 @@ def directory_contents(directory_path):
89
  return contents
90
  else : pass
91
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  # Delete a list of file
94
  def delete_files(file_paths):
 
89
  return contents
90
  else : pass
91
 
92
+ def absolute_path(directory_path):
93
+ path_list = []
94
+ if os.path.isdir(directory_path):
95
+ contents = os.listdir(directory_path)
96
+ for item in contents:
97
+ item_path = os.path.join(directory_path,item)
98
+ abs_path = os.path.abspath(item_path)
99
+ path_list.append(abs_path)
100
+ return path_list
101
+
102
+
103
 
104
  # Delete a list of file
105
  def delete_files(file_paths):