Logan Zoellner commited on
Commit
aa35052
1 Parent(s): 78317e6

cleanup slightly

Browse files
Files changed (2) hide show
  1. app.py +1 -97
  2. words.py +93 -0
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import os
5
  import re
6
  import random
 
7
 
8
  # GPT-J-6B API
9
  API_URL = "https://api-inference.huggingface.co/models/EleutherAI/gpt-j-6B"
@@ -21,9 +22,6 @@ examples = [["river"], ["night"], ["trees"],["table"],["laughs"]]
21
 
22
  def npc_randomize():
23
  #name is a random combination of syllables
24
- vowels = list("aeiou")
25
- constants = list("bcdfghjklmnpqrstvwxyz")
26
- seperators=list("-'")
27
  name =""
28
  for i in range(random.randint(2,4)):
29
  name += random.choice(constants)
@@ -32,109 +30,15 @@ def npc_randomize():
32
  name += random.choice(constants)
33
  if random.random()<0.1:
34
  name += random.choice(seperators)
35
-
36
  #capitalize first letter
37
  name = name[0].upper() + name[1:]
38
-
39
- races="""Dwarf
40
- Elf
41
- Halfling
42
- Human
43
- Dragonborn
44
- Gnome
45
- Half-elf
46
- Half-orc
47
- Tiefling
48
- Aarakocra
49
- Genasi
50
- Goliath""".split("\n")
51
-
52
- races=[x.strip() for x in races]
53
-
54
  race=random.choice(races)
55
-
56
- print("foo",races,race)
57
-
58
-
59
- classes="""Barbarian
60
- Bard
61
- Cleric
62
- Druid
63
- Fighter
64
- Monk
65
- Paladin
66
- Ranger
67
- Rogue
68
- Sorcerer
69
- Warlock
70
- Wizard""".split("\n")
71
-
72
- classes=[x.strip() for x in classes]
73
-
74
  characterClass=random.choice(classes)
75
-
76
  pronoun=random.choices(["he","she","they"],weights=[0.45,0.45,0.1],k=1)[0]
77
-
78
  return name,race,characterClass,pronoun
79
 
80
 
81
-
82
-
83
  def genericDescription():
84
- colors="""red
85
- blue
86
- green
87
- yellow
88
- orange
89
- purple
90
- pink
91
- brown
92
- black
93
- white""".split("\n")
94
- colors=[x.strip() for x in colors]
95
- outfits="""shirt
96
- pair of pants
97
- pair of shoes
98
- hat
99
- pair of glasses
100
- backpack
101
- belt
102
- tie
103
- cloak
104
- robe
105
- chain mail vest
106
- suit of plate armor
107
- suit of leather armor
108
- suit of studded leather armor
109
- suit of scale armor
110
- suit of chain mail armor
111
- suit of ring mail armor
112
- """.split("\n")
113
- outfits=[x.strip() for x in outfits]
114
- weapons="""sword
115
- dagger
116
- mace
117
- axe
118
- polearm
119
- bow
120
- crossbow
121
- sling
122
- club
123
- flail
124
- warhammer
125
- morningstar
126
- halberd
127
- war pick
128
- war sickle
129
- war hammer""".split("\n")
130
- weapons=[x.strip() for x in weapons]
131
-
132
- objects="""shield
133
- lantern
134
- sack
135
- severed head
136
- crystal""".split("\n")
137
- objects=[x.strip() for x in objects]
138
 
139
  desc=" wears a {color} {outfit}".format(color=random.choice(colors),outfit=random.choice(outfits))
140
  if random.random()<0.5:
4
  import os
5
  import re
6
  import random
7
+ from words import *
8
 
9
  # GPT-J-6B API
10
  API_URL = "https://api-inference.huggingface.co/models/EleutherAI/gpt-j-6B"
22
 
23
  def npc_randomize():
24
  #name is a random combination of syllables
 
 
 
25
  name =""
26
  for i in range(random.randint(2,4)):
27
  name += random.choice(constants)
30
  name += random.choice(constants)
31
  if random.random()<0.1:
32
  name += random.choice(seperators)
 
33
  #capitalize first letter
34
  name = name[0].upper() + name[1:]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  race=random.choice(races)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  characterClass=random.choice(classes)
 
37
  pronoun=random.choices(["he","she","they"],weights=[0.45,0.45,0.1],k=1)[0]
 
38
  return name,race,characterClass,pronoun
39
 
40
 
 
 
41
  def genericDescription():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  desc=" wears a {color} {outfit}".format(color=random.choice(colors),outfit=random.choice(outfits))
44
  if random.random()<0.5:
words.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ vowels = list("aeiou")
3
+ constants = list("bcdfghjklmnpqrstvwxyz")
4
+ seperators=list("-'")
5
+
6
+ races="""Dwarf
7
+ Elf
8
+ Halfling
9
+ Human
10
+ Dragonborn
11
+ Gnome
12
+ Half-elf
13
+ Half-orc
14
+ Tiefling
15
+ Aarakocra
16
+ Genasi
17
+ Goliath""".split("\n")
18
+
19
+ races=[x.strip() for x in races]
20
+
21
+
22
+
23
+
24
+ classes="""Barbarian
25
+ Bard
26
+ Cleric
27
+ Druid
28
+ Fighter
29
+ Monk
30
+ Paladin
31
+ Ranger
32
+ Rogue
33
+ Sorcerer
34
+ Warlock
35
+ Wizard""".split("\n")
36
+ classes=[x.strip() for x in classes]
37
+
38
+ colors="""red
39
+ blue
40
+ green
41
+ yellow
42
+ orange
43
+ purple
44
+ pink
45
+ brown
46
+ black
47
+ white""".split("\n")
48
+ colors=[x.strip() for x in colors]
49
+
50
+ outfits="""shirt
51
+ pair of pants
52
+ pair of shoes
53
+ hat
54
+ pair of glasses
55
+ backpack
56
+ belt
57
+ tie
58
+ cloak
59
+ robe
60
+ chain mail vest
61
+ suit of plate armor
62
+ suit of leather armor
63
+ suit of studded leather armor
64
+ suit of scale armor
65
+ suit of chain mail armor
66
+ suit of ring mail armor
67
+ """.split("\n")
68
+ outfits=[x.strip() for x in outfits]
69
+
70
+ weapons="""sword
71
+ dagger
72
+ mace
73
+ axe
74
+ polearm
75
+ bow
76
+ crossbow
77
+ sling
78
+ club
79
+ flail
80
+ warhammer
81
+ morningstar
82
+ halberd
83
+ war pick
84
+ war sickle
85
+ war hammer""".split("\n")
86
+ weapons=[x.strip() for x in weapons]
87
+
88
+ objects="""shield
89
+ lantern
90
+ sack
91
+ severed head
92
+ crystal""".split("\n")
93
+ objects=[x.strip() for x in objects]