Update app.py
Browse files
app.py
CHANGED
@@ -102,11 +102,13 @@ def save_game(background_img,star_img,enemy_img,platform_img,dude_img):
|
|
102 |
#platform_img.save(f"{uid}-platform_img.png")
|
103 |
#dude_img.save(f"{uid}-dude_img.png")
|
104 |
user_repo=save_data.split('datasets/',1)[1].split('/raw',1)[0]
|
|
|
105 |
try:
|
106 |
r = requests.get(f'{save_data}game_data.json')
|
107 |
lod = json.loads(r.text)
|
|
|
|
|
108 |
except:
|
109 |
-
lod=[]
|
110 |
pass
|
111 |
timestamp=str(datetime.datetime.now())
|
112 |
timename=timestamp.replace(" ","--").replace(":","-").replace(".","-")
|
@@ -153,9 +155,9 @@ def save_game(background_img,star_img,enemy_img,platform_img,dude_img):
|
|
153 |
#'dude_url': f'https://huggingface.co/datasets/{repo}/{space}/raw/main/{dude_img}',
|
154 |
}
|
155 |
print(block)
|
156 |
-
|
157 |
|
158 |
-
json_object = json.dumps(
|
159 |
with open("tmp1.json", "w") as outfile:
|
160 |
outfile.write(json_object)
|
161 |
try:
|
|
|
102 |
#platform_img.save(f"{uid}-platform_img.png")
|
103 |
#dude_img.save(f"{uid}-dude_img.png")
|
104 |
user_repo=save_data.split('datasets/',1)[1].split('/raw',1)[0]
|
105 |
+
out_lod=[]
|
106 |
try:
|
107 |
r = requests.get(f'{save_data}game_data.json')
|
108 |
lod = json.loads(r.text)
|
109 |
+
out_load.append(lod)
|
110 |
+
print (load)
|
111 |
except:
|
|
|
112 |
pass
|
113 |
timestamp=str(datetime.datetime.now())
|
114 |
timename=timestamp.replace(" ","--").replace(":","-").replace(".","-")
|
|
|
155 |
#'dude_url': f'https://huggingface.co/datasets/{repo}/{space}/raw/main/{dude_img}',
|
156 |
}
|
157 |
print(block)
|
158 |
+
out_lod.append(block)
|
159 |
|
160 |
+
json_object = json.dumps(out_lod, indent=4)
|
161 |
with open("tmp1.json", "w") as outfile:
|
162 |
outfile.write(json_object)
|
163 |
try:
|