Update app.py
Browse files
app.py
CHANGED
@@ -103,8 +103,9 @@ def compress_history(formatted_prompt):
|
|
103 |
return output
|
104 |
|
105 |
|
106 |
-
def comment_generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1028, top_p=0.95, repetition_penalty=1.0,):
|
107 |
#def question_generate(prompt, history):
|
|
|
108 |
print("###############\nRUNNING QUESTION GENERATOR\n###############\n")
|
109 |
seed = random.randint(1,1111111111111111)
|
110 |
agent=prompts.COMMENTER.format(focus=main_point[0])
|
@@ -132,9 +133,16 @@ def comment_generate(prompt, history, agent_name=agents[0], sys_prompt="", tempe
|
|
132 |
|
133 |
for response in stream:
|
134 |
output += response.token.text
|
135 |
-
|
136 |
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
def reply_generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,):
|
140 |
#def question_generate(prompt, history):
|
@@ -314,12 +322,12 @@ def generate(prompt, history, post_check, agent_name=agents[0], sys_prompt="", t
|
|
314 |
|
315 |
#prompt = question_generate(output, history)
|
316 |
#main_point[0]=prompt
|
317 |
-
|
318 |
|
319 |
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
else:
|
324 |
print("passing blog")
|
325 |
|
|
|
103 |
return output
|
104 |
|
105 |
|
106 |
+
def comment_generate(prompt, history,post_check, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1028, top_p=0.95, repetition_penalty=1.0,):
|
107 |
#def question_generate(prompt, history):
|
108 |
+
full_conv=history
|
109 |
print("###############\nRUNNING QUESTION GENERATOR\n###############\n")
|
110 |
seed = random.randint(1,1111111111111111)
|
111 |
agent=prompts.COMMENTER.format(focus=main_point[0])
|
|
|
133 |
|
134 |
for response in stream:
|
135 |
output += response.token.text
|
136 |
+
history.append((output,None))
|
137 |
|
138 |
+
post_check['comment']=post_check['comment']+1
|
139 |
+
#out_json = {'user':"",'datetime':current_time,'title':title,'blog':1,'comment':0,'reply':0,"prompt":prompt,"output":output}
|
140 |
+
full_conv.append((history,))
|
141 |
+
html_out=load_html(full_conv,title)
|
142 |
+
|
143 |
+
#history.append((output,history))
|
144 |
+
#[textbox, chatbot, textbox, json, json, html]
|
145 |
+
return "",history,post_check,post_check,post_check,html_out
|
146 |
|
147 |
def reply_generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,):
|
148 |
#def question_generate(prompt, history):
|
|
|
322 |
|
323 |
#prompt = question_generate(output, history)
|
324 |
#main_point[0]=prompt
|
325 |
+
full_conv.append((output,prompt))
|
326 |
|
327 |
|
328 |
+
html_out=load_html(full_conv,title)
|
329 |
+
post_check={'user':"",'datetime':current_time,'title':title,'blog':1,'comment':0,'reply':0}
|
330 |
+
yield prompt, history,post_check, summary[0],json_obj,json_hist,html_out
|
331 |
else:
|
332 |
print("passing blog")
|
333 |
|