Omnibus commited on
Commit
5ec32be
1 Parent(s): 07b5e22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -152,9 +152,16 @@ def create_valid_filename(invalid_filename: str) -> str:
152
 
153
 
154
  def load_html(inp):
 
 
 
 
 
 
 
155
  with open('index.html','r') as h:
156
  html=h.read()
157
- html = html.replace("$body",f"{inp}")
158
  h.close()
159
  return html
160
 
@@ -180,6 +187,7 @@ def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0
180
  sum_out=[]
181
  json_hist={}
182
  json_obj={}
 
183
  filename=create_valid_filename(f'{prompt}---{current_time}')
184
  post_cnt=1
185
  while True:
@@ -271,11 +279,12 @@ def generate(prompt, history, agent_name=agents[0], sys_prompt="", temperature=0
271
  )
272
 
273
 
274
- prompt = question_generate(output, history)
275
  main_point[0]=prompt
 
276
 
277
 
278
- html_out=load_html(history)
279
  yield prompt, history, summary[0],json_obj,json_hist,html_out
280
  return prompt, history, summary[0],json_obj,json_hist,html_out
281
 
 
152
 
153
 
154
  def load_html(inp):
155
+ ht=""
156
+ for ea in inp:
157
+ outp,prom=ea
158
+ ht+=f"""<div>
159
+ <pre>{outp}</pre>
160
+ <pre>{prom}</pre>
161
+ </div>"""
162
  with open('index.html','r') as h:
163
  html=h.read()
164
+ html = html.replace("$body",f"{ht}")
165
  h.close()
166
  return html
167
 
 
187
  sum_out=[]
188
  json_hist={}
189
  json_obj={}
190
+ full_conv=[]
191
  filename=create_valid_filename(f'{prompt}---{current_time}')
192
  post_cnt=1
193
  while True:
 
279
  )
280
 
281
 
282
+ prompt = question_generate(output, history)
283
  main_point[0]=prompt
284
+ full_conv.append((output,prompt))
285
 
286
 
287
+ html_out=load_html(full_conv)
288
  yield prompt, history, summary[0],json_obj,json_hist,html_out
289
  return prompt, history, summary[0],json_obj,json_hist,html_out
290