Omnibus commited on
Commit
ce9f05c
·
verified ·
1 Parent(s): 5caaf1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -233,13 +233,25 @@ 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
  News Articles:
241
  {new_data}
242
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  def summarize(inp,history,data=None):
244
  json_box=[]
245
  if inp == "":
@@ -287,7 +299,7 @@ def summarize(inp,history,data=None):
287
  new_data = out[s:e]
288
  #yield "", [(inp,f'{mes}\n{new_history}')]
289
 
290
- content = NEWS_REPORTER.format(new_data=str(new_data.replace("{","").replace("}","")))
291
  stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
292
  for response in stream:
293
  resp += response.token.text
 
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
+ {output_format}
237
+
 
 
238
  News Articles:
239
  {new_data}
240
  """
241
+ output_format="""[
242
+ {
243
+ "title": "title of the first article",
244
+ "description": "description of the article",
245
+ "article": "your custom written article",
246
+ "links": "all source links that have contributed to the article"
247
+ },
248
+ {
249
+ "title": "title of the second article",
250
+ "description": "description of the article",
251
+ "article": "your custom written article",
252
+ "links": "all source links that have contributed to the article"
253
+ }
254
+ ]"""
255
  def summarize(inp,history,data=None):
256
  json_box=[]
257
  if inp == "":
 
299
  new_data = out[s:e]
300
  #yield "", [(inp,f'{mes}\n{new_history}')]
301
 
302
+ content = NEWS_REPORTER.format(output_format=output_format,new_data=str(new_data.replace("{","").replace("}","")))
303
  stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
304
  for response in stream:
305
  resp += response.token.text