mecoffey commited on
Commit
6cdf5c3
·
1 Parent(s): 67c9cd2

added bard stats and changed regular stats to random generation. Intern forgot that the model wont consistently give just an integer.

Browse files
Files changed (2) hide show
  1. app.py +33 -25
  2. traits.txt +56 -0
app.py CHANGED
@@ -31,6 +31,12 @@ constitution = ''
31
  intelligence = ''
32
  wisdom = ''
33
  charisma = ''
 
 
 
 
 
 
34
 
35
 
36
  @spaces.GPU
@@ -41,23 +47,31 @@ def char_description(prompt):
41
  prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {prompt}\n\nDescribe:"
42
  output2 = pipe(prompt2, return_full_text=False, max_new_tokens=128)
43
  global strength
44
- strength_prompt = f"{STAT_SYSTEM_PROMPT} Strength for {output1}"
45
- strength = pipe(strength_prompt, return_full_text=False)
46
  global dexterity
47
- dexterity_prompt = f"{STAT_SYSTEM_PROMPT} Dexterity for {output1}"
48
- dexterity = int(pipe(dexterity_prompt, return_full_text=False))
49
  global constitution
50
- constitution_prompt = f"{STAT_SYSTEM_PROMPT} Constitution for {output1}"
51
- constitution = int(pipe(constitution_prompt, return_full_text=False))
52
  global intelligence
53
- intelligence_prompt = f"{STAT_SYSTEM_PROMPT} Intelligence for {output1}"
54
- intelligence = int(pipe(intelligence_prompt, return_full_text=False))
55
  global wisdom
56
- wisdom_prompt = f"{STAT_SYSTEM_PROMPT} Wisdom for {output1}"
57
- wisdom = int(pipe(wisdom_prompt, return_full_text=False))
58
  global charisma
59
- charisma_prompt = f"{STAT_SYSTEM_PROMPT} Charisma for {output1}"
60
- charisma = int(pipe(charisma_prompt, return_full_text=False))
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  return output1[0]["generated_text"].strip(),output2[0]["generated_text"].strip()
62
 
63
  @spaces.GPU
@@ -70,23 +84,17 @@ def rand_char_description():
70
  prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
71
  output2 = pipe(prompt2, return_full_text=False, max_new_tokens=128)
72
  global strength
73
- strength_prompt = f"{STAT_SYSTEM_PROMPT} Strength for {output1}"
74
- strength = pipe(strength_prompt, return_full_text=False)
75
  global dexterity
76
- dexterity_prompt = f"{STAT_SYSTEM_PROMPT} Dexterity for {output1}"
77
- dexterity = int(pipe(dexterity_prompt, return_full_text=False))
78
  global constitution
79
- constitution_prompt = f"{STAT_SYSTEM_PROMPT} Constitution for {output1}"
80
- constitution = int(pipe(constitution_prompt, return_full_text=False))
81
  global intelligence
82
- intelligence_prompt = f"{STAT_SYSTEM_PROMPT} Intelligence for {output1}"
83
- intelligence = int(pipe(intelligence_prompt, return_full_text=False))
84
  global wisdom
85
- wisdom_prompt = f"{STAT_SYSTEM_PROMPT} Wisdom for {output1}"
86
- wisdom = int(pipe(wisdom_prompt, return_full_text=False))
87
  global charisma
88
- charisma_prompt = f"{STAT_SYSTEM_PROMPT} Charisma for {output1}"
89
- charisma = int(pipe(charisma_prompt, return_full_text=False))
90
  return output1[0]["generated_text"].strip(),output2[0]["generated_text"].strip()
91
 
92
 
@@ -132,7 +140,7 @@ with gr.Blocks() as demo:
132
 
133
  with gr.Accordion("Bard Stats", open = False):
134
  with gr.Row():
135
- dcs = gr.Textbox(label = "DC to Smash")
136
  prefs = gr.Textbox(label = "Advantage if:")
137
  icks = gr.Textbox(label = "Disdvantage if:")
138
 
 
31
  intelligence = ''
32
  wisdom = ''
33
  charisma = ''
34
+ ac = ''
35
+ hp = ''
36
+ smash = ''
37
+ pref_traits = ''
38
+ ick_traits = ''
39
+
40
 
41
 
42
  @spaces.GPU
 
47
  prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {prompt}\n\nDescribe:"
48
  output2 = pipe(prompt2, return_full_text=False, max_new_tokens=128)
49
  global strength
50
+ strength = random.randint[2,12]
 
51
  global dexterity
52
+ dexterity = random.randint[2,12]
 
53
  global constitution
54
+ constitution = random.randint[2,12]
 
55
  global intelligence
56
+ intelligence = random.randint[2,12]
 
57
  global wisdom
58
+ wisdom = random.randint[2,12]
 
59
  global charisma
60
+ charisma = random.randint[2,12]
61
+ global ac
62
+ ac = random.randint[2,14]
63
+ global hp
64
+ hp = constitution + random.randint[1,6]
65
+ global smash
66
+ smash = random.randint[1,30]
67
+ input_file = open('traits.txt', 'r')
68
+ traits = input_file.readline()
69
+ global pref_traits
70
+ picks = random.randint[1,3]
71
+ pref_traits = random.choice(traits, k=picks)
72
+ global ick_traits
73
+ picks = random.randint[1,3]
74
+ ick_traits = random.choice(traits, k=picks)
75
  return output1[0]["generated_text"].strip(),output2[0]["generated_text"].strip()
76
 
77
  @spaces.GPU
 
84
  prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
85
  output2 = pipe(prompt2, return_full_text=False, max_new_tokens=128)
86
  global strength
87
+ strength = random.randint[2,12]
 
88
  global dexterity
89
+ dexterity = random.randint[2,12]
 
90
  global constitution
91
+ constitution = random.randint[2,12]
 
92
  global intelligence
93
+ intelligence = random.randint[2,12]
 
94
  global wisdom
95
+ wisdom = random.randint[2,12]
 
96
  global charisma
97
+ charisma = random.randint[2,12]
 
98
  return output1[0]["generated_text"].strip(),output2[0]["generated_text"].strip()
99
 
100
 
 
140
 
141
  with gr.Accordion("Bard Stats", open = False):
142
  with gr.Row():
143
+ dcs = gr.Textbox(value = smash, label = "DC to Smash")
144
  prefs = gr.Textbox(label = "Advantage if:")
145
  icks = gr.Textbox(label = "Disdvantage if:")
146
 
traits.txt ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Dragonborn
2
+ Dwarf
3
+ Eladrin
4
+ Elf
5
+ Fairy
6
+ Firbolg
7
+ Gnome
8
+ Goblin
9
+ Half-elf
10
+ Half-orc
11
+ Halfling
12
+ Human
13
+ Orc
14
+ Tiefling
15
+ Male
16
+ Female
17
+ Nonbinary
18
+ Gender ambiguous
19
+ Blue eyes
20
+ Green eyes
21
+ Brown eyes
22
+ Yellow eyes
23
+ Pink eyes
24
+ Purple eyes
25
+ Red eyes
26
+ Orange eyes
27
+ dexterity under 10
28
+ constitution under 10
29
+ intelligence under 10
30
+ wisdom under 10
31
+ charisma under 10
32
+ strength over 10
33
+ dexterity over 10
34
+ constitution over 10
35
+ intelligence over 10
36
+ wisdom over 10
37
+ charisma over 10
38
+ Black hair
39
+ Red hair
40
+ Blonde hair
41
+ Blue hair
42
+ Green hair
43
+ Pink hair
44
+ Facial hair
45
+ Clean shaven
46
+ Gold over 100
47
+ Gold under 100
48
+ Married
49
+ Unmarried
50
+ Height under 4ft
51
+ Height under 6ft
52
+ Height over 4ft
53
+ Height over 6ft
54
+ strength under 10
55
+ Under 30 years old
56
+ Over 30 years old