Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -339,7 +339,7 @@ def summarize(inp,history,report_check,sum_mem_check,data=None,files=None,url=No
|
|
339 |
c +=1
|
340 |
print (f'c:: {c}')
|
341 |
if sum_mem_check=="Memory":
|
342 |
-
save_memory(inp,out)
|
343 |
rawp = "Complete"
|
344 |
if sum_mem_check=="Summarize":
|
345 |
json_out = compress_data(c,inp,out)
|
@@ -373,8 +373,8 @@ Your final response should be only the final formatted JSON string enclosed in b
|
|
373 |
Required keys:
|
374 |
"keywords":["short", "list", "of", "keywords", "relevant", "to", "this", "entry"]
|
375 |
"title":"title of entry"
|
376 |
-
"description":"
|
377 |
-
"content":"full content of data
|
378 |
"url":"https://url.source"
|
379 |
"""
|
380 |
|
@@ -401,7 +401,7 @@ def save_memory(purpose, history):
|
|
401 |
print(f'chunk:: {chunk}')
|
402 |
print(f'divr:: {divr}')
|
403 |
print (f'divi:: {divi}')
|
404 |
-
|
405 |
#out=""
|
406 |
s=0
|
407 |
e=chunk
|
@@ -425,8 +425,8 @@ def save_memory(purpose, history):
|
|
425 |
#new_history = resp
|
426 |
print (resp)
|
427 |
#out+=resp
|
428 |
-
e=e+chunk
|
429 |
-
s=s+chunk
|
430 |
print ("final1" + resp)
|
431 |
try:
|
432 |
resp='[{'+resp.split('[{')[1].split('</s>')[0]
|
@@ -483,7 +483,7 @@ def save_memory(purpose, history):
|
|
483 |
#ea=s1
|
484 |
print(s1)
|
485 |
key_box.append(s1)
|
486 |
-
lod.append({"file_name":timename,"keywords":key_box})
|
487 |
json_object = json.dumps(lod, indent=4)
|
488 |
with open(f"tmp2-{uid}.json", "w") as outfile2:
|
489 |
outfile2.write(json_object)
|
@@ -495,8 +495,8 @@ def save_memory(purpose, history):
|
|
495 |
token=token_self,
|
496 |
repo_type="dataset",
|
497 |
)
|
498 |
-
|
499 |
-
|
500 |
|
501 |
|
502 |
|
|
|
339 |
c +=1
|
340 |
print (f'c:: {c}')
|
341 |
if sum_mem_check=="Memory":
|
342 |
+
json_out = save_memory(inp,out)
|
343 |
rawp = "Complete"
|
344 |
if sum_mem_check=="Summarize":
|
345 |
json_out = compress_data(c,inp,out)
|
|
|
373 |
Required keys:
|
374 |
"keywords":["short", "list", "of", "keywords", "relevant", "to", "this", "entry"]
|
375 |
"title":"title of entry"
|
376 |
+
"description":"summary of the entry"
|
377 |
+
"content":"full content of the data"
|
378 |
"url":"https://url.source"
|
379 |
"""
|
380 |
|
|
|
401 |
print(f'chunk:: {chunk}')
|
402 |
print(f'divr:: {divr}')
|
403 |
print (f'divi:: {divi}')
|
404 |
+
out_box = []
|
405 |
#out=""
|
406 |
s=0
|
407 |
e=chunk
|
|
|
425 |
#new_history = resp
|
426 |
print (resp)
|
427 |
#out+=resp
|
428 |
+
e=e+chunk-1000
|
429 |
+
s=s+chunk-1000
|
430 |
print ("final1" + resp)
|
431 |
try:
|
432 |
resp='[{'+resp.split('[{')[1].split('</s>')[0]
|
|
|
483 |
#ea=s1
|
484 |
print(s1)
|
485 |
key_box.append(s1)
|
486 |
+
lod.append({"file_name":timename,"keywords":key_box, "index":f"{s}:{e}"})
|
487 |
json_object = json.dumps(lod, indent=4)
|
488 |
with open(f"tmp2-{uid}.json", "w") as outfile2:
|
489 |
outfile2.write(json_object)
|
|
|
495 |
token=token_self,
|
496 |
repo_type="dataset",
|
497 |
)
|
498 |
+
out_box.append(resp)
|
499 |
+
return out_box
|
500 |
|
501 |
|
502 |
|