Spaces:
Sleeping
Sleeping
bugfixes
Browse files
app.py
CHANGED
|
@@ -21,9 +21,7 @@ BACK_SYSTEM_PROMPT = (
|
|
| 21 |
"Include one line about what the character is thinking or doing right now."
|
| 22 |
"Do not include any descriptions of physical features."
|
| 23 |
)
|
| 24 |
-
|
| 25 |
-
"give a single whole integer between 2 and 12 that reflects how proficient is a skill the described character is for this character's stat of:"
|
| 26 |
-
)
|
| 27 |
|
| 28 |
strength = ''
|
| 29 |
dexterity = ''
|
|
@@ -43,9 +41,9 @@ ick_traits = ''
|
|
| 43 |
def char_description(prompt):
|
| 44 |
|
| 45 |
prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {prompt}\n\nDescribe:"
|
| 46 |
-
output1 = pipe(prompt1, return_full_text=False, max_new_tokens=
|
| 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=
|
| 49 |
global strength
|
| 50 |
strength = random.randint[2,12]
|
| 51 |
global dexterity
|
|
@@ -80,9 +78,9 @@ def rand_char_description():
|
|
| 80 |
races = input_file.readline()
|
| 81 |
rand_race = random.choice(races)
|
| 82 |
prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {rand_race}\n\nDescribe:"
|
| 83 |
-
output1 = pipe(prompt1, return_full_text=False, max_new_tokens=
|
| 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=
|
| 86 |
global strength
|
| 87 |
strength = random.randint[2,12]
|
| 88 |
global dexterity
|
|
@@ -97,9 +95,6 @@ def rand_char_description():
|
|
| 97 |
charisma = random.randint[2,12]
|
| 98 |
return output1[0]["generated_text"].strip(),output2[0]["generated_text"].strip()
|
| 99 |
|
| 100 |
-
|
| 101 |
-
# need to add bard stats generation.
|
| 102 |
-
|
| 103 |
##UI is fine as-is
|
| 104 |
with gr.Blocks() as demo:
|
| 105 |
title = gr.HTML("<center><h1>NPC Generator</h1></center>")
|
|
@@ -113,7 +108,7 @@ with gr.Blocks() as demo:
|
|
| 113 |
btn = gr.Button("Generate")
|
| 114 |
rand = gr.Button("Random")
|
| 115 |
|
| 116 |
-
with gr.Row():
|
| 117 |
|
| 118 |
with gr.Column(scale = 0):
|
| 119 |
stre_box = gr.Textbox(value = strength, label = "Strength", interactive = False)
|
|
@@ -141,8 +136,8 @@ with gr.Blocks() as demo:
|
|
| 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 |
|
| 147 |
|
| 148 |
# Need to add export feature.
|
|
|
|
| 21 |
"Include one line about what the character is thinking or doing right now."
|
| 22 |
"Do not include any descriptions of physical features."
|
| 23 |
)
|
| 24 |
+
|
|
|
|
|
|
|
| 25 |
|
| 26 |
strength = ''
|
| 27 |
dexterity = ''
|
|
|
|
| 41 |
def char_description(prompt):
|
| 42 |
|
| 43 |
prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {prompt}\n\nDescribe:"
|
| 44 |
+
output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
|
| 45 |
prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {prompt}\n\nDescribe:"
|
| 46 |
+
output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
|
| 47 |
global strength
|
| 48 |
strength = random.randint[2,12]
|
| 49 |
global dexterity
|
|
|
|
| 78 |
races = input_file.readline()
|
| 79 |
rand_race = random.choice(races)
|
| 80 |
prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {rand_race}\n\nDescribe:"
|
| 81 |
+
output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
|
| 82 |
prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
|
| 83 |
+
output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
|
| 84 |
global strength
|
| 85 |
strength = random.randint[2,12]
|
| 86 |
global dexterity
|
|
|
|
| 95 |
charisma = random.randint[2,12]
|
| 96 |
return output1[0]["generated_text"].strip(),output2[0]["generated_text"].strip()
|
| 97 |
|
|
|
|
|
|
|
|
|
|
| 98 |
##UI is fine as-is
|
| 99 |
with gr.Blocks() as demo:
|
| 100 |
title = gr.HTML("<center><h1>NPC Generator</h1></center>")
|
|
|
|
| 108 |
btn = gr.Button("Generate")
|
| 109 |
rand = gr.Button("Random")
|
| 110 |
|
| 111 |
+
with gr.Row(equal_height=True):
|
| 112 |
|
| 113 |
with gr.Column(scale = 0):
|
| 114 |
stre_box = gr.Textbox(value = strength, label = "Strength", interactive = False)
|
|
|
|
| 136 |
with gr.Accordion("Bard Stats", open = False):
|
| 137 |
with gr.Row():
|
| 138 |
dcs = gr.Textbox(value = smash, label = "DC to Smash")
|
| 139 |
+
prefs = gr.Textbox(value = pref_traits, label = "Advantage if:")
|
| 140 |
+
icks = gr.Textbox(value = ick_traits, label = "Disdvantage if:")
|
| 141 |
|
| 142 |
|
| 143 |
# Need to add export feature.
|