Omnibus commited on
Commit
f3d467a
1 Parent(s): 19bea57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -17
app.py CHANGED
@@ -23,6 +23,22 @@ summary.append("")
23
  main_point.append("")
24
  list_of_users=["user1","user2","user3"]
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  models=[
27
  "mistralai/Mixtral-8x7B-Instruct-v0.1",
28
  "mistralai/Mixtral-8x7B-Instruct-v0.2",
@@ -116,7 +132,7 @@ def comment_generate(prompt, history,post_check,full_conv,persona2, agent_name=a
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:
@@ -163,7 +179,7 @@ def comment_generate(prompt, history,post_check,full_conv,persona2, agent_name=a
163
  lod = json.loads(r.text)
164
  print(f'lod:: {lod}')
165
  lod[0]['comment']=lod[0]['comment']+1
166
- lod[0]['comment_list'].append({'user':list_of_users[1],'datetime':'','comment':output,'reply_list':[]})
167
  #hist_out.append(out_json)
168
  #try:
169
  # for ea in
@@ -193,7 +209,7 @@ def reply_generate(prompt, history,post_check,full_conv,persona1, agent_name=age
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:
@@ -237,7 +253,7 @@ def reply_generate(prompt, history,post_check,full_conv,persona1, agent_name=age
237
  lod = json.loads(r.text)
238
  print(f'lod:: {lod}')
239
  lod[0]['reply']=lod[0]['reply']+1
240
- lod[0]['comment_list'][0]['reply_list'].append({'user':list_of_users[1],'datetime':'','reply':output})
241
  #hist_out.append(out_json)
242
  #try:
243
  # for ea in
@@ -375,7 +391,7 @@ def generate(prompt, history, post_check,full_conv,persona1, agent_name=agents[0
375
  current_time=current_time.replace(":","-")
376
  current_time=current_time.replace(".","-")
377
  print (current_time)
378
- agent=prompts.BLOG_POSTER
379
  system_prompt=agent
380
  temperature = float(temperature)
381
  if temperature < 1e-2:
@@ -480,8 +496,8 @@ def generate(prompt, history, post_check,full_conv,persona1, agent_name=agents[0
480
  full_conv.append((output,None,None))
481
 
482
 
483
- html_out=load_html(full_conv,title,list_of_users[0])
484
- post_check={'filename':filename,'user':list_of_users[0],'datetime':current_time,'title':title,'blog':1,'comment':0,'reply':0}
485
  yield prompt, history,post_check,full_conv,summary[0],json_obj,json_hist,html_out
486
  else:
487
  print("passing blog")
@@ -620,16 +636,7 @@ def generate_OG(prompt, history, agent_name=agents[0], sys_prompt="", temperatur
620
  return prompt, history, summary[0],json_obj,json_hist,html_out
621
 
622
 
623
- persona=[
624
- {"name":"Mr. Nice Guy", "description":"Nice","personality":"friendly, caring, helpful and informative. You always compliment people, and stick up for them, and you have no patience for bullies."},
625
- {"name":"Mr. Mean Guy", "description":"Mean","personality":"a total asshole. You think you are really smart, but really you are just ignorant and mean. You don't have time for everybodies stupidity, and you let them know that in the comments."},
626
- {"name":"Smarty Pants", "description":"Genius","personality":"intelligent, informative, know-it-all. You are the smartest guy in the room and always one-up the blog poster to show how mart you are."},
627
- {"name":"Try Hard", "description":"Not Genius","personality":"dimwitted, lacking understanding about any topic. You always ask really irrelevant questions about the post."},
628
- {"name":"Class Clown", "description":"Humerous","personality":"humerous, funny. You turn everything into a joke. Make a joke about the post."},
629
- ]
630
- persona_names=[]
631
- for ea in persona:
632
- persona_names.append(ea['name'])
633
 
634
  with gr.Blocks() as app:
635
 
 
23
  main_point.append("")
24
  list_of_users=["user1","user2","user3"]
25
 
26
+ persona=[
27
+ {"name":"Mr. Nice Guy", "description":"Nice","personality":"friendly, caring, helpful and informative. You always compliment people, and stick up for them, and you have no patience for bullies."},
28
+ {"name":"Mr. Mean Guy", "description":"Mean","personality":"a total asshole. You think you are really smart, but really you are just ignorant and mean. You don't have time for everybodies stupidity, and you let them know that in the comments."},
29
+ {"name":"Smarty Pants", "description":"Genius","personality":"intelligent, informative, know-it-all. You are the smartest guy in the room and always one-up the blog poster to show how mart you are."},
30
+ {"name":"Try Hard", "description":"Not Genius","personality":"dimwitted, lacking understanding about any topic. You always ask really irrelevant questions about the post."},
31
+ {"name":"Class Clown", "description":"Humerous","personality":"humerous, funny. You turn everything into a joke. Make a joke about the post."},
32
+ ]
33
+ persona_names=[]
34
+ for ea in persona:
35
+ persona_names.append(ea['name'])
36
+
37
+
38
+
39
+
40
+
41
+
42
  models=[
43
  "mistralai/Mixtral-8x7B-Instruct-v0.1",
44
  "mistralai/Mixtral-8x7B-Instruct-v0.2",
 
132
  seed = random.randint(1,1111111111111111)
133
  #agent=prompts.COMMENTER.format(focus=main_point[0])
134
  #bp,_,_=full_conv[0]
135
+ agent=prompts.COMMENTER.format(focus=full_conv[0][0],persona=persona2['personality'])
136
  system_prompt=agent
137
  temperature = float(temperature)
138
  if temperature < 1e-2:
 
179
  lod = json.loads(r.text)
180
  print(f'lod:: {lod}')
181
  lod[0]['comment']=lod[0]['comment']+1
182
+ lod[0]['comment_list'].append({'user':persona2['name'],'datetime':'','comment':output,'reply_list':[]})
183
  #hist_out.append(out_json)
184
  #try:
185
  # for ea in
 
209
  print(f'full_conv::\n{full_conv}')
210
  print("###############\nRUNNING REPLY GENERATOR\n###############\n")
211
  seed = random.randint(1,1111111111111111)
212
+ agent=prompts.REPLY_TO_COMMENTER.format(focus=full_conv[0][0],comment=full_conv[1][1],persona=persona1['personality'])
213
  system_prompt=agent
214
  temperature = float(temperature)
215
  if temperature < 1e-2:
 
253
  lod = json.loads(r.text)
254
  print(f'lod:: {lod}')
255
  lod[0]['reply']=lod[0]['reply']+1
256
+ lod[0]['comment_list'][0]['reply_list'].append({'user':persona1['name'],'datetime':'','reply':output})
257
  #hist_out.append(out_json)
258
  #try:
259
  # for ea in
 
391
  current_time=current_time.replace(":","-")
392
  current_time=current_time.replace(".","-")
393
  print (current_time)
394
+ agent=prompts.BLOG_POSTER.format(persona=persona1['personality'])
395
  system_prompt=agent
396
  temperature = float(temperature)
397
  if temperature < 1e-2:
 
496
  full_conv.append((output,None,None))
497
 
498
 
499
+ html_out=load_html(full_conv,title,persona1['name'])
500
+ post_check={'filename':filename,'user':persona1['name'],'datetime':current_time,'title':title,'blog':1,'comment':0,'reply':0}
501
  yield prompt, history,post_check,full_conv,summary[0],json_obj,json_hist,html_out
502
  else:
503
  print("passing blog")
 
636
  return prompt, history, summary[0],json_obj,json_hist,html_out
637
 
638
 
639
+
 
 
 
 
 
 
 
 
 
640
 
641
  with gr.Blocks() as app:
642