Update app.py
Browse files
app.py
CHANGED
|
@@ -116,12 +116,9 @@ def save_game(name,score):
|
|
| 116 |
r = requests.get(f'{save_data}game_data.json')
|
| 117 |
lod = json.loads(r.text)
|
| 118 |
#out_lod.append(lod)
|
| 119 |
-
print (lod)
|
| 120 |
except:
|
| 121 |
lod=[]
|
| 122 |
pass
|
| 123 |
-
|
| 124 |
-
print(timestamp)
|
| 125 |
try:
|
| 126 |
api.upload_file(
|
| 127 |
path_or_fileobj=f"{uid}_sky.png",
|
|
@@ -133,7 +130,6 @@ def save_game(name,score):
|
|
| 133 |
except Exception as e:
|
| 134 |
print (e)
|
| 135 |
pass
|
| 136 |
-
|
| 137 |
try:
|
| 138 |
api.upload_file(
|
| 139 |
path_or_fileobj=f"{uid}_star.png",
|
|
@@ -145,7 +141,6 @@ def save_game(name,score):
|
|
| 145 |
except Exception as e:
|
| 146 |
print (e)
|
| 147 |
pass
|
| 148 |
-
|
| 149 |
try:
|
| 150 |
api.upload_file(
|
| 151 |
path_or_fileobj=f"{uid}_enemy.png",
|
|
@@ -156,7 +151,29 @@ def save_game(name,score):
|
|
| 156 |
)
|
| 157 |
except Exception as e:
|
| 158 |
print (e)
|
| 159 |
-
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
block = {'index': len(lod) + 1,
|
| 161 |
'timestamp': timestamp,
|
| 162 |
'game_name': game,
|
|
@@ -164,8 +181,8 @@ def save_game(name,score):
|
|
| 164 |
'background_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/background/{game}-background_img.png',
|
| 165 |
'star_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/star/{game}-star_img.png',
|
| 166 |
'enemy_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/enemy/{game}-enemy_img.png',
|
| 167 |
-
|
| 168 |
-
|
| 169 |
}
|
| 170 |
print(block)
|
| 171 |
lod.append(block)
|
|
@@ -193,8 +210,8 @@ def save_game(name,score):
|
|
| 193 |
'background_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/background/{game}-background_img.png',
|
| 194 |
'star_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/star/{game}-star_img.png',
|
| 195 |
'enemy_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/enemy/{game}-enemy_img.png',
|
| 196 |
-
|
| 197 |
-
|
| 198 |
}
|
| 199 |
print(block)
|
| 200 |
game_box.append(block2)
|
|
|
|
| 116 |
r = requests.get(f'{save_data}game_data.json')
|
| 117 |
lod = json.loads(r.text)
|
| 118 |
#out_lod.append(lod)
|
|
|
|
| 119 |
except:
|
| 120 |
lod=[]
|
| 121 |
pass
|
|
|
|
|
|
|
| 122 |
try:
|
| 123 |
api.upload_file(
|
| 124 |
path_or_fileobj=f"{uid}_sky.png",
|
|
|
|
| 130 |
except Exception as e:
|
| 131 |
print (e)
|
| 132 |
pass
|
|
|
|
| 133 |
try:
|
| 134 |
api.upload_file(
|
| 135 |
path_or_fileobj=f"{uid}_star.png",
|
|
|
|
| 141 |
except Exception as e:
|
| 142 |
print (e)
|
| 143 |
pass
|
|
|
|
| 144 |
try:
|
| 145 |
api.upload_file(
|
| 146 |
path_or_fileobj=f"{uid}_enemy.png",
|
|
|
|
| 151 |
)
|
| 152 |
except Exception as e:
|
| 153 |
print (e)
|
| 154 |
+
pass
|
| 155 |
+
try:
|
| 156 |
+
api.upload_file(
|
| 157 |
+
path_or_fileobj=platform,
|
| 158 |
+
path_in_repo=f"{save_data.split('main/',1)[1]}/images/platform/{game}-platform_img.png",
|
| 159 |
+
repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
| 160 |
+
token=token_self,
|
| 161 |
+
repo_type="dataset",
|
| 162 |
+
)
|
| 163 |
+
except Exception as e:
|
| 164 |
+
print (e)
|
| 165 |
+
pass
|
| 166 |
+
try:
|
| 167 |
+
api.upload_file(
|
| 168 |
+
path_or_fileobj=dude,
|
| 169 |
+
path_in_repo=f"{save_data.split('main/',1)[1]}/images/enemy/{game}-dude_img.png",
|
| 170 |
+
repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
| 171 |
+
token=token_self,
|
| 172 |
+
repo_type="dataset",
|
| 173 |
+
)
|
| 174 |
+
except Exception as e:
|
| 175 |
+
print (e)
|
| 176 |
+
pass
|
| 177 |
block = {'index': len(lod) + 1,
|
| 178 |
'timestamp': timestamp,
|
| 179 |
'game_name': game,
|
|
|
|
| 181 |
'background_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/background/{game}-background_img.png',
|
| 182 |
'star_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/star/{game}-star_img.png',
|
| 183 |
'enemy_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/enemy/{game}-enemy_img.png',
|
| 184 |
+
'platform_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/enemy/{game}-enemy_img.png',
|
| 185 |
+
'dude_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/enemy/{game}-dude_img.png',
|
| 186 |
}
|
| 187 |
print(block)
|
| 188 |
lod.append(block)
|
|
|
|
| 210 |
'background_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/background/{game}-background_img.png',
|
| 211 |
'star_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/star/{game}-star_img.png',
|
| 212 |
'enemy_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/enemy/{game}-enemy_img.png',
|
| 213 |
+
'platform_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/enemy/{game}-enemy_img.png',
|
| 214 |
+
'dude_url': f'https://huggingface.co/datasets/{user_repo}/resolve/main/images/enemy/{game}-dude_img.png',
|
| 215 |
}
|
| 216 |
print(block)
|
| 217 |
game_box.append(block2)
|