Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -439,6 +439,7 @@ def format_json(inp):
|
|
| 439 |
#if line.startswith()
|
| 440 |
|
| 441 |
def create_index():
|
|
|
|
| 442 |
|
| 443 |
####### load index ###############
|
| 444 |
r = requests.get(f'{save_data}mem-test2/index.json')
|
|
@@ -472,7 +473,18 @@ def create_index():
|
|
| 472 |
except Exception as e:
|
| 473 |
print (e)
|
| 474 |
|
| 475 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
|
| 477 |
|
| 478 |
|
|
|
|
| 439 |
#if line.startswith()
|
| 440 |
|
| 441 |
def create_index():
|
| 442 |
+
uid=uuid.uuid4()
|
| 443 |
|
| 444 |
####### load index ###############
|
| 445 |
r = requests.get(f'{save_data}mem-test2/index.json')
|
|
|
|
| 473 |
except Exception as e:
|
| 474 |
print (e)
|
| 475 |
|
| 476 |
+
json_object = json.dumps(ind, indent=4)
|
| 477 |
+
with open(f"tmp3-{uid}.json", "w") as outfile3:
|
| 478 |
+
outfile3.write(json_object)
|
| 479 |
+
outfile3.close()
|
| 480 |
+
api.upload_file(
|
| 481 |
+
path_or_fileobj=f"tmp3-{uid}.json",
|
| 482 |
+
path_in_repo=f"/mem-test2/index.json",
|
| 483 |
+
repo_id=reponame,
|
| 484 |
+
#repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
| 485 |
+
token=token_self,
|
| 486 |
+
repo_type="dataset",
|
| 487 |
+
)
|
| 488 |
|
| 489 |
|
| 490 |
|