Update app.py
Browse files
app.py
CHANGED
@@ -142,7 +142,7 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
142 |
star_out=open(star_im,'rb')
|
143 |
try:
|
144 |
api.upload_file(
|
145 |
-
path_or_fileobj=
|
146 |
path_in_repo=f"{save_data.split('main/',1)[1]}/images/star/{game}-star_img.png",
|
147 |
repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
148 |
token=token_self,
|
@@ -151,9 +151,12 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
151 |
except Exception as e:
|
152 |
print (e)
|
153 |
pass
|
|
|
|
|
|
|
154 |
try:
|
155 |
api.upload_file(
|
156 |
-
path_or_fileobj=
|
157 |
path_in_repo=f"{save_data.split('main/',1)[1]}/images/enemy/{game}-enemy_img.png",
|
158 |
repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
159 |
token=token_self,
|
|
|
142 |
star_out=open(star_im,'rb')
|
143 |
try:
|
144 |
api.upload_file(
|
145 |
+
path_or_fileobj=star_out,
|
146 |
path_in_repo=f"{save_data.split('main/',1)[1]}/images/star/{game}-star_img.png",
|
147 |
repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
148 |
token=token_self,
|
|
|
151 |
except Exception as e:
|
152 |
print (e)
|
153 |
pass
|
154 |
+
enemy_out=open(enemy_im,'rb')
|
155 |
+
enemy_out.save('tmp_enemy.png','wb')
|
156 |
+
|
157 |
try:
|
158 |
api.upload_file(
|
159 |
+
path_or_fileobj='tmp_enemy.png',
|
160 |
path_in_repo=f"{save_data.split('main/',1)[1]}/images/enemy/{game}-enemy_img.png",
|
161 |
repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
162 |
token=token_self,
|