Omnibus commited on
Commit
f29440c
·
verified ·
1 Parent(s): 8b6759c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -212,7 +212,7 @@ def load_html(inp,title):
212
 
213
 
214
 
215
- def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1048, top_p=0.95, repetition_penalty=1.0):
216
  html_out=""
217
  #main_point[0]=prompt
218
  #print(datetime.datetime.now())
@@ -237,7 +237,7 @@ def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0
237
  full_conv=[]
238
  post_cnt=1
239
  seed = random.randint(1,1111111111111111)
240
- if not history:
241
  generate_kwargs = dict(
242
  temperature=temperature,
243
  max_new_tokens=max_new_tokens2,
@@ -317,9 +317,9 @@ def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0
317
 
318
 
319
  html_out=load_html(full_conv,title)
320
- yield prompt, history, summary[0],json_obj,json_hist,html_out
321
- else:
322
- pass
323
 
324
  def generate_OG(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1048, top_p=0.95, repetition_penalty=1.0):
325
  html_out=""
@@ -485,7 +485,7 @@ with gr.Blocks() as app:
485
  m_choice.change(load_models,m_choice,[chatbot])
486
  app.load(load_models,m_choice,[chatbot]).then(load_html,None,html)
487
 
488
- sub_b = submit_b.click(generate, [msg,chatbot,tokens],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
489
  sub_c = submit_c.click(comment_generate, [msg,chatbot,tokens],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
490
  sub_r = submit_r.click(reply_generate, [msg,chatbot,tokens],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
491
  sub_e = msg.submit(generate, [msg, chatbot,tokens], [msg, chatbot,sumbox,sum_out_box,hist_out_box,html])
 
212
 
213
 
214
 
215
+ def generate(prompt, history, post_check, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1048, top_p=0.95, repetition_penalty=1.0):
216
  html_out=""
217
  #main_point[0]=prompt
218
  #print(datetime.datetime.now())
 
237
  full_conv=[]
238
  post_cnt=1
239
  seed = random.randint(1,1111111111111111)
240
+ if not post_check:
241
  generate_kwargs = dict(
242
  temperature=temperature,
243
  max_new_tokens=max_new_tokens2,
 
317
 
318
 
319
  html_out=load_html(full_conv,title)
320
+ post_check.append('blog':1)
321
+ yield prompt, history,post_check, summary[0],json_obj,json_hist,html_out
322
+
323
 
324
  def generate_OG(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1048, top_p=0.95, repetition_penalty=1.0):
325
  html_out=""
 
485
  m_choice.change(load_models,m_choice,[chatbot])
486
  app.load(load_models,m_choice,[chatbot]).then(load_html,None,html)
487
 
488
+ sub_b = submit_b.click(generate, [msg,chatbot,post_handler,tokens],[msg,chatbot,post_handler,sumbox,sum_out_box,hist_out_box,html])
489
  sub_c = submit_c.click(comment_generate, [msg,chatbot,tokens],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
490
  sub_r = submit_r.click(reply_generate, [msg,chatbot,tokens],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
491
  sub_e = msg.submit(generate, [msg, chatbot,tokens], [msg, chatbot,sumbox,sum_out_box,hist_out_box,html])