Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -242,7 +242,6 @@ def save_memory(purpose, history):
|
|
242 |
repo_type="dataset",
|
243 |
)
|
244 |
lines = resp.strip().strip("\n").split("\n")
|
245 |
-
|
246 |
try:
|
247 |
r = requests.get(f'{save_data}mem-test/main.json')
|
248 |
if r.status_code==200:
|
@@ -254,21 +253,25 @@ def save_memory(purpose, history):
|
|
254 |
for i,line in enumerate(lines):
|
255 |
if ":" in line:
|
256 |
print(f'line:: {line}')
|
257 |
-
|
258 |
-
|
259 |
-
|
|
|
|
|
|
|
|
|
260 |
print(keyw)
|
261 |
-
lod.append({"file_name":timename,"keywords":keyw})
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
except Exception as e:
|
273 |
print (e)
|
274 |
return [resp]
|
|
|
242 |
repo_type="dataset",
|
243 |
)
|
244 |
lines = resp.strip().strip("\n").split("\n")
|
|
|
245 |
try:
|
246 |
r = requests.get(f'{save_data}mem-test/main.json')
|
247 |
if r.status_code==200:
|
|
|
253 |
for i,line in enumerate(lines):
|
254 |
if ":" in line:
|
255 |
print(f'line:: {line}')
|
256 |
+
|
257 |
+
if "keywords" in line[:16]:
|
258 |
+
print(f'trying:: {line}')
|
259 |
+
keyw=line.split(":")[1]
|
260 |
+
print (keyw)
|
261 |
+
print (keyw.split("[")[1].split("]")[0])
|
262 |
+
keyw=keyw.split("[")[1].split("]")[0]
|
263 |
print(keyw)
|
264 |
+
lod.append({"file_name":timename,"keywords":[keyw]})
|
265 |
+
with open(f"tmp2-{uid}.json", "w") as outfile2:
|
266 |
+
outfile2.write(str(lod))
|
267 |
+
api.upload_file(
|
268 |
+
path_or_fileobj=f"tmp2-{uid}.json",
|
269 |
+
path_in_repo=f"/mem-test/main.json",
|
270 |
+
repo_id=reponame,
|
271 |
+
#repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
272 |
+
token=token_self,
|
273 |
+
repo_type="dataset",
|
274 |
+
)
|
275 |
except Exception as e:
|
276 |
print (e)
|
277 |
return [resp]
|