rf5860 commited on
Commit
1f1a749
1 Parent(s): 14393ba
Files changed (1) hide show
  1. app.py +44 -0
app.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ def generate_characters():
5
+ class_list = ["Barbarian","Bard","Cleric","Druid","Fighter","Monk","Paladin","Ranger","Rogue","Sorcerer","Warlock","Wizard"]
6
+ sub_class_list = ["Barbarian - Beserker","Barbarian - Wildheart","Barbarian - Wild Magic","Bard - College of Lore","Bard - College of Valour","Bard - College of Swords","Cleric - Life Domain","Cleric - Light Domain","Cleric - Trickery Domain","Cleric - Knowledge Domain","Cleric - Nature Domain","Cleric - Tempest Domain","Cleric - War Domain","Druid - Circle of the moon","Druid - Circle of the Land","Druid - Circle of the Spores","Fighter - Battle Master","Fighter - Eldritch Knight","Fighter - Champion","Monk - Way of the open hand","Monk - Way of shadow","Monk - Way of the four elements","Paladin - Oath of Devotion","Paladin - Oath of the ancients","Paladin - Oath of Vengence","Paladin - Oathbreaker","Ranger - Beat Master","Ranger - Hunter","Ranger - Gloom Stalker","Rogue - Thief","Rogue - Arcane Trickster","Rogue - Assassin","Sorcerer - Draconic Bloodline","Sorcerer - Wild Magic","Sorcerer - Storm Sorcery","Warlock - The Fiend","Warlock - the great old one","Warlock - Archfey","Wizard - Abjuration","Wizard - Conjuration","Wizard - Divination","Wizard - Enchantment","Wizard - Evocation","Wizard - Necromancer","Wizard - Illusion","Wizard - Transmutation"]
7
+ race_list = ["Dragonborn","Drow","Dwarf","Elf","Githyanki","Gnome","Half-Elf","Half-Orc","Halfling","Human","Tiefling"]
8
+ sub_race_list = ["Black Dragonborn","Blue Dragonborn","Brass Dragonborn","Bronze Dragonborn","Copper Dragonborn","Gold Dragonborn","Green Dragonborn","Red Dragonborn","Silver Dragonborn","White Dragonborn","Lolth-Sworn Drow","Seldarine Drow","Gold Dwarf","Shield Dwarf","Duegar (Dwarf)","High Elf - Elf","Wood Elf - Elf","Githyanki","Deep Gnome","Forest Gnome","Rock Gnome","High Half-Elf","Wood Half-Elf","Drow Half-Elf","Half-Orc","Lightfoot Halfling","Strongheart Halfling","Human","Asmodeus Tiefling","Mephistopheles Tiefling","Zariel Tiefling"]
9
+ alignment_list = ["Chaotic Good","Lawful Good","Neutral Good","Chaotic Evil","Lawful Evil","Neutral Evil","True Chaotic","True Neutral"]
10
+ background_list = ["Acolyte","Charlatan","Criminal","Entertainer","Folk Hero","Guild Artisan","Noble","Hermit","Outlander","Sage","Soldier"]
11
+
12
+ def generate_character():
13
+ character = {
14
+ 'Class': random.choice(class_list),
15
+ 'Sub Class': random.choice(sub_class_list),
16
+ 'Race': random.choice(race_list),
17
+ 'Sub Race': random.choice(sub_race_list),
18
+ 'Alignment': random.choice(alignment_list),
19
+ 'Background': random.choice(background_list),
20
+ }
21
+ return character
22
+
23
+ def generate_multiclass_character():
24
+ character = generate_character()
25
+ second_class = random.choice([cls for cls in class_list if cls != character['Class']])
26
+ levels_class1 = random.randint(1, 11)
27
+ levels_class2 = 12 - levels_class1
28
+ character['Class'] += f' ({levels_class1} levels), {second_class} ({levels_class2} levels)'
29
+ return character
30
+
31
+ characters = [generate_character() for _ in range(2)]
32
+ characters.append(generate_multiclass_character())
33
+
34
+ output = ""
35
+ for idx, char in enumerate(characters, 1):
36
+ output += f"### Character {idx}:\n"
37
+ for key, value in char.items():
38
+ output += f"- **{key}:** {value}\n"
39
+ output += "\n"
40
+
41
+ return output
42
+
43
+ iface = gr.Interface(fn=generate_characters, inputs=[], outputs="markdown")
44
+ iface.launch()