Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -530,6 +530,7 @@ def save_memory(purpose, history):
|
|
| 530 |
lod = []
|
| 531 |
for i,line in enumerate(lines):
|
| 532 |
key_box=[]
|
|
|
|
| 533 |
#print(f'LINE:: {line}')
|
| 534 |
if ":" in line:
|
| 535 |
print(f'line:: {line}')
|
|
@@ -551,23 +552,28 @@ def save_memory(purpose, history):
|
|
| 551 |
#ea=s1
|
| 552 |
print(s1)
|
| 553 |
key_box.append(s1)
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
|
|
|
| 558 |
lod.append({"file_name":f"{timename}---{s}-{ee}","keywords":key_box,"description":str(desc),"index":f"{s}:{ee}"})
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
ee=ee+chunk
|
| 572 |
s=s+chunk
|
| 573 |
out_box.append(resp)
|
|
|
|
| 530 |
lod = []
|
| 531 |
for i,line in enumerate(lines):
|
| 532 |
key_box=[]
|
| 533 |
+
desc=""
|
| 534 |
#print(f'LINE:: {line}')
|
| 535 |
if ":" in line:
|
| 536 |
print(f'line:: {line}')
|
|
|
|
| 552 |
#ea=s1
|
| 553 |
print(s1)
|
| 554 |
key_box.append(s1)
|
| 555 |
+
if "description" in line and ":" in line:
|
| 556 |
+
#print(f'trying:: {line}')
|
| 557 |
+
desc=line.split(":")[1]
|
| 558 |
+
|
| 559 |
+
if key_box and desc:
|
| 560 |
lod.append({"file_name":f"{timename}---{s}-{ee}","keywords":key_box,"description":str(desc),"index":f"{s}:{ee}"})
|
| 561 |
+
key_box = []
|
| 562 |
+
desc=""
|
| 563 |
+
if lod:
|
| 564 |
+
json_object = json.dumps(lod, indent=4)
|
| 565 |
+
with open(f"tmp2-{uid}.json", "w") as outfile2:
|
| 566 |
+
outfile2.write(json_object)
|
| 567 |
+
outfile2.close()
|
| 568 |
+
api.upload_file(
|
| 569 |
+
path_or_fileobj=f"tmp2-{uid}.json",
|
| 570 |
+
path_in_repo=f"/mem-test2/main.json",
|
| 571 |
+
repo_id=reponame,
|
| 572 |
+
#repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
| 573 |
+
token=token_self,
|
| 574 |
+
repo_type="dataset",
|
| 575 |
+
)
|
| 576 |
+
|
| 577 |
ee=ee+chunk
|
| 578 |
s=s+chunk
|
| 579 |
out_box.append(resp)
|