Update app.py
Browse files
app.py
CHANGED
@@ -58,7 +58,7 @@ def sky_fn(inp):
|
|
58 |
rand = random.randint(1,200)
|
59 |
for i in range(rand):
|
60 |
inp+=" "
|
61 |
-
uid=uuid.uuid4()
|
62 |
output=proc1.send_it(inp,5,1)
|
63 |
print(output)
|
64 |
outp=Image.open(output[0])
|
@@ -80,7 +80,7 @@ def star_fn(inp):
|
|
80 |
rand = random.randint(1,200)
|
81 |
for i in range(rand):
|
82 |
inp+=" "
|
83 |
-
uid=uuid.uuid4()
|
84 |
output=proc2.send_it(inp,5,1)
|
85 |
outp=Image.open(output[0])
|
86 |
out=rm(outp)
|
@@ -94,7 +94,7 @@ def enemy_fn(inp):
|
|
94 |
rand = random.randint(1,200)
|
95 |
for i in range(rand):
|
96 |
inp+=" "
|
97 |
-
uid=uuid.uuid4()
|
98 |
output=proc2.send_it(inp,5,1)
|
99 |
outp=Image.open(output[0])
|
100 |
out=rm(outp)
|
@@ -129,7 +129,7 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
129 |
print(timestamp)
|
130 |
try:
|
131 |
api.upload_file(
|
132 |
-
path_or_fileobj=
|
133 |
path_in_repo=f"{save_data.split('main/',1)[1]}/images/background/{game}-background_img.png",
|
134 |
repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
135 |
token=token_self,
|
@@ -139,10 +139,10 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
139 |
print (e)
|
140 |
pass
|
141 |
|
142 |
-
star_out=open(
|
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,12 +151,12 @@ def save_game(name,score,background_im,star_im,enemy_im):
|
|
151 |
except Exception as e:
|
152 |
print (e)
|
153 |
pass
|
154 |
-
enemy_out=open(enemy_im,'rb')
|
155 |
-
|
156 |
|
157 |
try:
|
158 |
api.upload_file(
|
159 |
-
path_or_fileobj=
|
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,
|
|
|
58 |
rand = random.randint(1,200)
|
59 |
for i in range(rand):
|
60 |
inp+=" "
|
61 |
+
#uid=uuid.uuid4()
|
62 |
output=proc1.send_it(inp,5,1)
|
63 |
print(output)
|
64 |
outp=Image.open(output[0])
|
|
|
80 |
rand = random.randint(1,200)
|
81 |
for i in range(rand):
|
82 |
inp+=" "
|
83 |
+
#uid=uuid.uuid4()
|
84 |
output=proc2.send_it(inp,5,1)
|
85 |
outp=Image.open(output[0])
|
86 |
out=rm(outp)
|
|
|
94 |
rand = random.randint(1,200)
|
95 |
for i in range(rand):
|
96 |
inp+=" "
|
97 |
+
#uid=uuid.uuid4()
|
98 |
output=proc2.send_it(inp,5,1)
|
99 |
outp=Image.open(output[0])
|
100 |
out=rm(outp)
|
|
|
129 |
print(timestamp)
|
130 |
try:
|
131 |
api.upload_file(
|
132 |
+
path_or_fileobj=f"{uid}_sky.png",
|
133 |
path_in_repo=f"{save_data.split('main/',1)[1]}/images/background/{game}-background_img.png",
|
134 |
repo_id=save_data.split('datasets/',1)[1].split('/raw',1)[0],
|
135 |
token=token_self,
|
|
|
139 |
print (e)
|
140 |
pass
|
141 |
|
142 |
+
#star_out=open(f"{uid}_star.png",'rb')
|
143 |
try:
|
144 |
api.upload_file(
|
145 |
+
path_or_fileobj=f"{uid}_star.png",
|
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_im.save('tmp_enemy.png')
|
156 |
|
157 |
try:
|
158 |
api.upload_file(
|
159 |
+
path_or_fileobj=f"{uid}_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,
|