mecoffey commited on
Commit
a0f1f68
·
1 Parent(s): d6abc60

fixed intern error with filename, stripped responses to make them more readable.

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -25,17 +25,17 @@ def char_description(prompt):
25
  output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
26
  prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {prompt}\n\nDescribe:"
27
  output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
28
- return output1, output2
29
 
30
  def rand_char_description():
31
- input_file = open(core_races.txt, 'r')
32
  races = input_file.readline()
33
  rand_race = random.choice(races)
34
  prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {rand_race}\n\nDescribe:"
35
  output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
36
  prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
37
  output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
38
- return output1, output2
39
 
40
  #if the prompt is blank, use random number to choose a race and class from lists. The lists will only
41
  # include the most common of each. This will be fed in as the user prompt in leiu of a real one.
 
25
  output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
26
  prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {prompt}\n\nDescribe:"
27
  output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
28
+ return output1,output2[0]["generated_text"].strip()
29
 
30
  def rand_char_description():
31
+ input_file = open('core_races.txt', 'r')
32
  races = input_file.readline()
33
  rand_race = random.choice(races)
34
  prompt1 = f"{DESC_SYSTEM_PROMPT}\n\nCharacter Description: {rand_race}\n\nDescribe:"
35
  output1 = pipe(prompt1, return_full_text=False, max_new_tokens=256)
36
  prompt2 = f"{BACK_SYSTEM_PROMPT}\n\n{output1}\n\nUser prompt: {rand_race}\n\nDescribe:"
37
  output2 = pipe(prompt2, return_full_text=False, max_new_tokens=256)
38
+ return output1,output2[0]["generated_text"].strip()
39
 
40
  #if the prompt is blank, use random number to choose a race and class from lists. The lists will only
41
  # include the most common of each. This will be fed in as the user prompt in leiu of a real one.