Spaces:
Sleeping
Sleeping
stripped model responses to not include system prompt
Browse files
app.py
CHANGED
|
@@ -39,9 +39,9 @@ ick_traits = ''
|
|
| 39 |
def char_description(prompt):
|
| 40 |
|
| 41 |
prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {prompt}\n\nDescribe:"
|
| 42 |
-
output1 = pipe(prompt1)
|
| 43 |
prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {prompt}\n\nDescribe:"
|
| 44 |
-
output2 = pipe(prompt2)
|
| 45 |
global strength
|
| 46 |
strength = random.randint(2,12)
|
| 47 |
global dexterity
|
|
@@ -68,7 +68,7 @@ def char_description(prompt):
|
|
| 68 |
global ick_traits
|
| 69 |
picks = random.randint(1,3)
|
| 70 |
ick_traits = random.choice(traits, k=picks)
|
| 71 |
-
return output1,output2
|
| 72 |
|
| 73 |
@spaces.GPU
|
| 74 |
def rand_char_description():
|
|
@@ -76,9 +76,9 @@ def rand_char_description():
|
|
| 76 |
races = input_file.readline()
|
| 77 |
rand_race = random.choice(races)
|
| 78 |
prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {rand_race}\n\nDescribe:"
|
| 79 |
-
output1 = pipe(prompt1)
|
| 80 |
prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
|
| 81 |
-
output2 = pipe(prompt2)
|
| 82 |
global strength
|
| 83 |
strength = random.randint(2,12)
|
| 84 |
global dexterity
|
|
@@ -91,7 +91,7 @@ def rand_char_description():
|
|
| 91 |
wisdom = random.randint(2,12)
|
| 92 |
global charisma
|
| 93 |
charisma = random.randint(2,12)
|
| 94 |
-
return output1,output2
|
| 95 |
|
| 96 |
##UI is fine as-is
|
| 97 |
with gr.Blocks() as demo:
|
|
|
|
| 39 |
def char_description(prompt):
|
| 40 |
|
| 41 |
prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {prompt}\n\nDescribe:"
|
| 42 |
+
output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
|
| 43 |
prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {prompt}\n\nDescribe:"
|
| 44 |
+
output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
|
| 45 |
global strength
|
| 46 |
strength = random.randint(2,12)
|
| 47 |
global dexterity
|
|
|
|
| 68 |
global ick_traits
|
| 69 |
picks = random.randint(1,3)
|
| 70 |
ick_traits = random.choice(traits, k=picks)
|
| 71 |
+
return output1[0]["generated_text"].strip(),output2[0]["generated_text"].strip()
|
| 72 |
|
| 73 |
@spaces.GPU
|
| 74 |
def rand_char_description():
|
|
|
|
| 76 |
races = input_file.readline()
|
| 77 |
rand_race = random.choice(races)
|
| 78 |
prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {rand_race}\n\nDescribe:"
|
| 79 |
+
output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
|
| 80 |
prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
|
| 81 |
+
output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
|
| 82 |
global strength
|
| 83 |
strength = random.randint(2,12)
|
| 84 |
global dexterity
|
|
|
|
| 91 |
wisdom = random.randint(2,12)
|
| 92 |
global charisma
|
| 93 |
charisma = random.randint(2,12)
|
| 94 |
+
return output1[0]["generated_text"].strip(),output2[0]["generated_text"].strip()
|
| 95 |
|
| 96 |
##UI is fine as-is
|
| 97 |
with gr.Blocks() as demo:
|