Update app.py
Browse files
app.py
CHANGED
@@ -127,8 +127,9 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
127 |
pass
|
128 |
|
129 |
print(timestamp)
|
|
|
130 |
with open('tmp1.png','wb') as t1:
|
131 |
-
t1.write(
|
132 |
try:
|
133 |
api.upload_file(
|
134 |
path_or_fileobj='tmp1.png',
|
@@ -137,12 +138,14 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
137 |
token=token_self,
|
138 |
repo_type="dataset",
|
139 |
)
|
|
|
140 |
except Exception as e:
|
141 |
print (e)
|
142 |
pass
|
143 |
-
|
|
|
144 |
with open('tmp2.png','wb') as t2:
|
145 |
-
t2.write(
|
146 |
try:
|
147 |
api.upload_file(
|
148 |
path_or_fileobj='tmp2.png',
|
@@ -151,12 +154,14 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
151 |
token=token_self,
|
152 |
repo_type="dataset",
|
153 |
)
|
|
|
154 |
except Exception as e:
|
155 |
print (e)
|
156 |
pass
|
157 |
-
|
|
|
158 |
with open('tmp3.png','wb') as t3:
|
159 |
-
t3.write(
|
160 |
try:
|
161 |
api.upload_file(
|
162 |
path_or_fileobj='tmp3.png',
|
@@ -165,9 +170,12 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
165 |
token=token_self,
|
166 |
repo_type="dataset",
|
167 |
)
|
|
|
|
|
168 |
except Exception as e:
|
169 |
print (e)
|
170 |
-
pass
|
|
|
171 |
block = {'index': len(lod) + 1,
|
172 |
'timestamp': timestamp,
|
173 |
'game_name': game,
|
|
|
127 |
pass
|
128 |
|
129 |
print(timestamp)
|
130 |
+
i1 = open(f"{uid}_sky.png",'rb')
|
131 |
with open('tmp1.png','wb') as t1:
|
132 |
+
t1.write(i1)
|
133 |
try:
|
134 |
api.upload_file(
|
135 |
path_or_fileobj='tmp1.png',
|
|
|
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(f"{uid}_star.png",'rb')
|
147 |
with open('tmp2.png','wb') as t2:
|
148 |
+
t2.write(i2)
|
149 |
try:
|
150 |
api.upload_file(
|
151 |
path_or_fileobj='tmp2.png',
|
|
|
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(f"{uid}_enemy.png",'rb')
|
163 |
with open('tmp3.png','wb') as t3:
|
164 |
+
t3.write(i3)
|
165 |
try:
|
166 |
api.upload_file(
|
167 |
path_or_fileobj='tmp3.png',
|
|
|
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,
|