Update app.py
Browse files
app.py
CHANGED
|
@@ -127,9 +127,6 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
| 127 |
pass
|
| 128 |
|
| 129 |
print(timestamp)
|
| 130 |
-
i1 = open(background_im,'rb')
|
| 131 |
-
with open('tmp1.png','wb') as t1:
|
| 132 |
-
t1.write(i1)
|
| 133 |
try:
|
| 134 |
api.upload_file(
|
| 135 |
path_or_fileobj=background_im,
|
|
@@ -138,14 +135,9 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
| 138 |
token=token_self,
|
| 139 |
repo_type="dataset",
|
| 140 |
)
|
| 141 |
-
os.remove(t1)
|
| 142 |
except Exception as e:
|
| 143 |
print (e)
|
| 144 |
pass
|
| 145 |
-
i1.close()
|
| 146 |
-
i2 = open(star_im,'rb')
|
| 147 |
-
with open('tmp2.png','wb') as t2:
|
| 148 |
-
t2.write(i2)
|
| 149 |
try:
|
| 150 |
api.upload_file(
|
| 151 |
path_or_fileobj=star_im,
|
|
@@ -154,14 +146,9 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
| 154 |
token=token_self,
|
| 155 |
repo_type="dataset",
|
| 156 |
)
|
| 157 |
-
os.remove(t2)
|
| 158 |
except Exception as e:
|
| 159 |
print (e)
|
| 160 |
pass
|
| 161 |
-
i2.close()
|
| 162 |
-
i3 = open(enemy_im,'rb')
|
| 163 |
-
with open('tmp3.png','wb') as t3:
|
| 164 |
-
t3.write(i3)
|
| 165 |
try:
|
| 166 |
api.upload_file(
|
| 167 |
path_or_fileobj=enemy_im,
|
|
@@ -170,12 +157,9 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
| 170 |
token=token_self,
|
| 171 |
repo_type="dataset",
|
| 172 |
)
|
| 173 |
-
os.remove(t3)
|
| 174 |
-
|
| 175 |
except Exception as e:
|
| 176 |
print (e)
|
| 177 |
pass
|
| 178 |
-
i3.close()
|
| 179 |
block = {'index': len(lod) + 1,
|
| 180 |
'timestamp': timestamp,
|
| 181 |
'game_name': game,
|
|
|
|
| 127 |
pass
|
| 128 |
|
| 129 |
print(timestamp)
|
|
|
|
|
|
|
|
|
|
| 130 |
try:
|
| 131 |
api.upload_file(
|
| 132 |
path_or_fileobj=background_im,
|
|
|
|
| 135 |
token=token_self,
|
| 136 |
repo_type="dataset",
|
| 137 |
)
|
|
|
|
| 138 |
except Exception as e:
|
| 139 |
print (e)
|
| 140 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
try:
|
| 142 |
api.upload_file(
|
| 143 |
path_or_fileobj=star_im,
|
|
|
|
| 146 |
token=token_self,
|
| 147 |
repo_type="dataset",
|
| 148 |
)
|
|
|
|
| 149 |
except Exception as e:
|
| 150 |
print (e)
|
| 151 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
try:
|
| 153 |
api.upload_file(
|
| 154 |
path_or_fileobj=enemy_im,
|
|
|
|
| 157 |
token=token_self,
|
| 158 |
repo_type="dataset",
|
| 159 |
)
|
|
|
|
|
|
|
| 160 |
except Exception as e:
|
| 161 |
print (e)
|
| 162 |
pass
|
|
|
|
| 163 |
block = {'index': len(lod) + 1,
|
| 164 |
'timestamp': timestamp,
|
| 165 |
'game_name': game,
|