Omnibus commited on
Commit
5509f2d
1 Parent(s): 85fedd7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -106,7 +106,7 @@ def compress_history(formatted_prompt):
106
  return output
107
 
108
 
109
- def comment_generate(prompt, history,post_check,full_conv, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1028, top_p=0.95, repetition_penalty=1.3,):
110
  #def question_generate(prompt, history):
111
  uid=uuid.uuid4()
112
  print(post_check)
@@ -116,7 +116,7 @@ def comment_generate(prompt, history,post_check,full_conv, agent_name=agents[0],
116
  seed = random.randint(1,1111111111111111)
117
  #agent=prompts.COMMENTER.format(focus=main_point[0])
118
  #bp,_,_=full_conv[0]
119
- agent=prompts.COMMENTER.format(focus=full_conv[0][0])
120
  system_prompt=agent
121
  temperature = float(temperature)
122
  if temperature < 1e-2:
@@ -185,7 +185,7 @@ def comment_generate(prompt, history,post_check,full_conv, agent_name=agents[0],
185
 
186
 
187
 
188
- def reply_generate(prompt, history,post_check,full_conv, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1028, top_p=0.95, repetition_penalty=1.0,):
189
  #def question_generate(prompt, history):
190
  uid=uuid.uuid4()
191
  print(post_check)
@@ -193,7 +193,7 @@ def reply_generate(prompt, history,post_check,full_conv, agent_name=agents[0], s
193
  print(f'full_conv::\n{full_conv}')
194
  print("###############\nRUNNING REPLY GENERATOR\n###############\n")
195
  seed = random.randint(1,1111111111111111)
196
- agent=prompts.REPLY_TO_COMMENTER.format(focus=full_conv[0][0],comment=full_conv[1][1])
197
  system_prompt=agent
198
  temperature = float(temperature)
199
  if temperature < 1e-2:
@@ -363,7 +363,7 @@ def load_html_OG(inp,title):
363
 
364
 
365
 
366
- def generate(prompt, history, post_check,full_conv, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1048, top_p=0.95, repetition_penalty=1.0):
367
  html_out=""
368
  #main_point[0]=prompt
369
  #print(datetime.datetime.now())
@@ -653,8 +653,8 @@ with gr.Blocks() as app:
653
  with gr.Row():
654
  #persona1=gr.Textbox(label="Bot 1 Persona",info="Your personallity can be be described as...")
655
  #persona2=gr.Textbox(label="Bot 2 Persona",info="Your personallity can be be described as...")
656
- persona1=gr.Dropdown(label="Bot 1 Persona",choices=[p for p in persona_names])
657
- persona2=gr.Dropdown(label="Bot 2 Persona",choices=[p for p in persona_names])
658
 
659
  sumbox=gr.Textbox("Summary", max_lines=100)
660
  with gr.Column():
@@ -666,9 +666,9 @@ with gr.Blocks() as app:
666
  #app.load(load_models,m_choice,[chatbot]).then(load_html,None,html)
667
  app.load(load_models,m_choice,[chatbot])
668
 
669
- sub_b = submit_b.click(generate, [msg,chatbot,post_handler,chat_handler,chat_handler,tokens],[msg,chatbot,post_handler,chat_handler,sumbox,sum_out_box,hist_out_box,html])
670
- sub_c = submit_c.click(comment_generate, [msg,chatbot,post_handler,chat_handler],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
671
- sub_r = submit_r.click(reply_generate, [msg,chatbot,post_handler,chat_handler],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
672
  sub_e = msg.submit(generate, [msg,chatbot,post_handler,chat_handler,chat_handler,tokens],[msg,chatbot,post_handler,chat_handler,sumbox,sum_out_box,hist_out_box,html])
673
  stop_b.click(None,None,None, cancels=[sub_b,sub_e,sub_c,sub_r])
674
 
 
106
  return output
107
 
108
 
109
+ def comment_generate(prompt, history,post_check,full_conv,persona2, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1028, top_p=0.95, repetition_penalty=1.3,):
110
  #def question_generate(prompt, history):
111
  uid=uuid.uuid4()
112
  print(post_check)
 
116
  seed = random.randint(1,1111111111111111)
117
  #agent=prompts.COMMENTER.format(focus=main_point[0])
118
  #bp,_,_=full_conv[0]
119
+ agent=prompts.COMMENTER.format(focus=full_conv[0][0],persona=persona2)
120
  system_prompt=agent
121
  temperature = float(temperature)
122
  if temperature < 1e-2:
 
185
 
186
 
187
 
188
+ def reply_generate(prompt, history,post_check,full_conv,persona1, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1028, top_p=0.95, repetition_penalty=1.0,):
189
  #def question_generate(prompt, history):
190
  uid=uuid.uuid4()
191
  print(post_check)
 
193
  print(f'full_conv::\n{full_conv}')
194
  print("###############\nRUNNING REPLY GENERATOR\n###############\n")
195
  seed = random.randint(1,1111111111111111)
196
+ agent=prompts.REPLY_TO_COMMENTER.format(focus=full_conv[0][0],comment=full_conv[1][1],persona=persona1)
197
  system_prompt=agent
198
  temperature = float(temperature)
199
  if temperature < 1e-2:
 
363
 
364
 
365
 
366
+ def generate(prompt, history, post_check,full_conv,persona1, agent_name=agents[0], sys_prompt="", temperature=0.9, max_new_tokens=1048, top_p=0.95, repetition_penalty=1.0):
367
  html_out=""
368
  #main_point[0]=prompt
369
  #print(datetime.datetime.now())
 
653
  with gr.Row():
654
  #persona1=gr.Textbox(label="Bot 1 Persona",info="Your personallity can be be described as...")
655
  #persona2=gr.Textbox(label="Bot 2 Persona",info="Your personallity can be be described as...")
656
+ persona1=gr.Dropdown(label="Bot 1 Persona",value=persona_names[0],type='index',choices=[p for p in persona_names])
657
+ persona2=gr.Dropdown(label="Bot 2 Persona",value=persona_names[3],type='index',choices=[p for p in persona_names])
658
 
659
  sumbox=gr.Textbox("Summary", max_lines=100)
660
  with gr.Column():
 
666
  #app.load(load_models,m_choice,[chatbot]).then(load_html,None,html)
667
  app.load(load_models,m_choice,[chatbot])
668
 
669
+ sub_b = submit_b.click(generate, [msg,chatbot,post_handler,chat_handler,chat_handler,persona1,tokens],[msg,chatbot,post_handler,chat_handler,sumbox,sum_out_box,hist_out_box,html])
670
+ sub_c = submit_c.click(comment_generate, [msg,chatbot,post_handler,chat_handler,persona2],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
671
+ sub_r = submit_r.click(reply_generate, [msg,chatbot,post_handler,chat_handler,persona1],[msg,chatbot,sumbox,sum_out_box,hist_out_box,html])
672
  sub_e = msg.submit(generate, [msg,chatbot,post_handler,chat_handler,chat_handler,tokens],[msg,chatbot,post_handler,chat_handler,sumbox,sum_out_box,hist_out_box,html])
673
  stop_b.click(None,None,None, cancels=[sub_b,sub_e,sub_c,sub_r])
674