Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -241,6 +241,34 @@ def save_memory(purpose, history):
|
|
241 |
token=token_self,
|
242 |
repo_type="dataset",
|
243 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
#skills.append(resp)
|
245 |
#out=skills
|
246 |
#history = "result: {}\n".format(resp)
|
|
|
241 |
token=token_self,
|
242 |
repo_type="dataset",
|
243 |
)
|
244 |
+
|
245 |
+
try:
|
246 |
+
r = requests.get(f'{save_data}mem-test/main.json')
|
247 |
+
lod = json.loads(r.text)
|
248 |
+
#out_lod.append(lod)
|
249 |
+
except:
|
250 |
+
lod=[]
|
251 |
+
pass
|
252 |
+
lines = resp.strip().strip("\n").split("\n")
|
253 |
+
keyw_box=[]
|
254 |
+
#skill_dict={}
|
255 |
+
#option_drop=[]
|
256 |
+
for i,line in enumerate(lines):
|
257 |
+
if "keywords:" in line:
|
258 |
+
keyw=line.split("[")[1].split("]")[0]
|
259 |
+
print(keyw)
|
260 |
+
keyw_box.append({"file_name":timename,"keywords":keyw})
|
261 |
+
with open(f"tmp2-{uid}.json", "w") as outfile:
|
262 |
+
outfile.write(json.dumps(key_box))
|
263 |
+
api.upload_file(
|
264 |
+
path_or_fileobj=f"tmp2-{uid}.json",
|
265 |
+
path_in_repo=f"/mem-test/main.json",
|
266 |
+
repo_id=reponame,
|
267 |
+
#repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
268 |
+
token=token_self,
|
269 |
+
repo_type="dataset",
|
270 |
+
)
|
271 |
+
|
272 |
#skills.append(resp)
|
273 |
#out=skills
|
274 |
#history = "result: {}\n".format(resp)
|