Spaces:
Runtime error
Runtime error
app.py
CHANGED
@@ -70,17 +70,7 @@ def text_generate(prompt, generated_txt): #, input_prompt_sql ): #, input_prompt
|
|
70 |
else:
|
71 |
final_solution = solution
|
72 |
|
73 |
-
|
74 |
-
# if output_tmp.find('.') != -1:
|
75 |
-
# idx = output_tmp.find('.')
|
76 |
-
# poem = output_tmp[:idx+1]
|
77 |
-
# else:
|
78 |
-
# idx = output_tmp.rfind('\n')
|
79 |
-
# poem = output_tmp[:idx]
|
80 |
-
#else:
|
81 |
-
# poem = output_tmp.split("\n\n")[0] # +"."
|
82 |
-
#poem = poem.replace('?','')
|
83 |
-
#print(f"Poem being returned is: {poem}")
|
84 |
if len(generated_txt) == 0 :
|
85 |
display_output = final_solution
|
86 |
else:
|
@@ -92,16 +82,17 @@ def text_generate(prompt, generated_txt): #, input_prompt_sql ): #, input_prompt
|
|
92 |
temp_text = display_output[::-1]
|
93 |
print(f"What is the last character of sentence? : {temp_text[0]}")
|
94 |
if temp_text[1] == '.':
|
95 |
-
first_period_loc = temp_text[2:].find('.')
|
96 |
print(f"Location of last Period is: {first_period_loc}")
|
97 |
-
new_prompt = display_output[-first_period_loc
|
98 |
print(f"Not sending blank as prompt so new prompt for next cycle is : {new_prompt}")
|
99 |
else:
|
100 |
print("HERE")
|
101 |
first_period_loc = temp_text.find('.')
|
102 |
print(f"Location of last Period is : {first_period_loc}")
|
103 |
-
new_prompt = display_output[-first_period_loc
|
104 |
print(f"Not sending blank as prompt so new prompt for next cycle is : {new_prompt}")
|
|
|
105 |
|
106 |
return display_output, new_prompt #generated_txt+prompt #final_solution
|
107 |
|
|
|
70 |
else:
|
71 |
final_solution = solution
|
72 |
|
73 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
if len(generated_txt) == 0 :
|
75 |
display_output = final_solution
|
76 |
else:
|
|
|
82 |
temp_text = display_output[::-1]
|
83 |
print(f"What is the last character of sentence? : {temp_text[0]}")
|
84 |
if temp_text[1] == '.':
|
85 |
+
first_period_loc = temp_text[2:].find('.') + 1
|
86 |
print(f"Location of last Period is: {first_period_loc}")
|
87 |
+
new_prompt = display_output[-first_period_loc:-1]
|
88 |
print(f"Not sending blank as prompt so new prompt for next cycle is : {new_prompt}")
|
89 |
else:
|
90 |
print("HERE")
|
91 |
first_period_loc = temp_text.find('.')
|
92 |
print(f"Location of last Period is : {first_period_loc}")
|
93 |
+
new_prompt = display_output[-first_period_loc:-1]
|
94 |
print(f"Not sending blank as prompt so new prompt for next cycle is : {new_prompt}")
|
95 |
+
display_output = display_output[:-1]
|
96 |
|
97 |
return display_output, new_prompt #generated_txt+prompt #final_solution
|
98 |
|