Omnibus commited on
Commit
9b8267e
·
verified ·
1 Parent(s): 5958c2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -233,11 +233,12 @@ def get_key(inp,data):
233
  NEWS_REPORTER="""You are an Expert News Aggregator. Your duty is to compress all of the News Articles you are given into 10 or more individual articles that capture the full context of the current news. Compile your articles into JSON format which the user will load into an RSS reader for other users to read.
234
  Add NEW DATA that you recieve to your CURRENT DATA by combining and reformatting when needed.
235
  Output Format:
 
236
  "title": "title of the first article",
237
  "description": "description of the article",
238
  "article": "your custom written article",
239
- "links": "all source links that have contributed to the article",
240
-
241
 
242
  News Articles:
243
  {new_data}
@@ -289,7 +290,7 @@ def summarize(inp,history,data=None):
289
  new_data = out[s:e]
290
  #yield "", [(inp,f'{mes}\n{new_history}')]
291
 
292
- content = NEWS_REPORTER.format(new_data=str(new_data))
293
  stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
294
  for response in stream:
295
  resp += response.token.text
@@ -301,12 +302,14 @@ def summarize(inp,history,data=None):
301
 
302
  #out_json=""
303
  out_json=resp.replace("\n","").replace("```","")
 
304
  out_box.append(out_json.strip("</s>"))
305
  #out_box=out_box)
306
  print("ADDING")
307
  e=e+chunk
308
  s=s+chunk
309
- yield "", [(inp,resp)],out_box
 
310
 
311
  #history = "preliminary result: {}\n".format(resp)
312
  #yield "", (inp,f'{mes}\n{history}')
@@ -318,6 +321,7 @@ def summarize(inp,history,data=None):
318
  #out = str(out_hist)
319
  #rawp = out
320
  else:
 
321
  rawp = "Provide a valid data source"
322
  history.append((inp,rawp))
323
  yield "", history,None
@@ -498,6 +502,8 @@ def load_data(rss_url=None):
498
 
499
 
500
  def load_html(conv):
 
 
501
  ht=""
502
  ht+=f"""<div class="div_box">"""
503
  for ea in conv:
 
233
  NEWS_REPORTER="""You are an Expert News Aggregator. Your duty is to compress all of the News Articles you are given into 10 or more individual articles that capture the full context of the current news. Compile your articles into JSON format which the user will load into an RSS reader for other users to read.
234
  Add NEW DATA that you recieve to your CURRENT DATA by combining and reformatting when needed.
235
  Output Format:
236
+ [
237
  "title": "title of the first article",
238
  "description": "description of the article",
239
  "article": "your custom written article",
240
+ "links": "all source links that have contributed to the article"
241
+ ]
242
 
243
  News Articles:
244
  {new_data}
 
290
  new_data = out[s:e]
291
  #yield "", [(inp,f'{mes}\n{new_history}')]
292
 
293
+ content = NEWS_REPORTER.format(new_data=new_data)
294
  stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
295
  for response in stream:
296
  resp += response.token.text
 
302
 
303
  #out_json=""
304
  out_json=resp.replace("\n","").replace("```","")
305
+
306
  out_box.append(out_json.strip("</s>"))
307
  #out_box=out_box)
308
  print("ADDING")
309
  e=e+chunk
310
  s=s+chunk
311
+ print("DONE")
312
+ yield "", [(inp,resp)],out_box
313
 
314
  #history = "preliminary result: {}\n".format(resp)
315
  #yield "", (inp,f'{mes}\n{history}')
 
321
  #out = str(out_hist)
322
  #rawp = out
323
  else:
324
+ print("ERROR")
325
  rawp = "Provide a valid data source"
326
  history.append((inp,rawp))
327
  yield "", history,None
 
502
 
503
 
504
  def load_html(conv):
505
+ print("LOAD HTML")
506
+ print(conv)
507
  ht=""
508
  ht+=f"""<div class="div_box">"""
509
  for ea in conv: