Update app.py
Browse files
app.py
CHANGED
@@ -74,7 +74,7 @@ def sky_fn(inp):
|
|
74 |
out = os.path.abspath(f"{uid}_sky.png")
|
75 |
#out = os.path.abspath(outp)
|
76 |
out_url = f'https://omnibus-game-test.hf.space/file={out}'
|
77 |
-
return outp,out_url
|
78 |
|
79 |
def star_fn(inp):
|
80 |
rand = random.randint(1,200)
|
@@ -88,7 +88,7 @@ def star_fn(inp):
|
|
88 |
outrs.save(f"{uid}_star.png")
|
89 |
out_file = os.path.abspath(f"{uid}_star.png")
|
90 |
out_url = f'https://omnibus-game-test.hf.space/file={out_file}'
|
91 |
-
return out,out_url
|
92 |
|
93 |
def enemy_fn(inp):
|
94 |
rand = random.randint(1,200)
|
@@ -102,7 +102,7 @@ def enemy_fn(inp):
|
|
102 |
outrs.save(f"{uid}_enemy.png")
|
103 |
out_file = os.path.abspath(f"{uid}_enemy.png")
|
104 |
out_url = f'https://omnibus-game-test.hf.space/file={out_file}'
|
105 |
-
return out,out_url
|
106 |
|
107 |
def save_game(name,score):
|
108 |
user_repo=save_data.split('datasets/',1)[1].split('/raw',1)[0]
|
@@ -294,9 +294,9 @@ with gr.Blocks() as app:
|
|
294 |
get_score.click(return_score,score,[score],_js=score_js)
|
295 |
save_btn.click(return_score,score,[score],_js=score_js).then(save_game,[game_name,score],message)
|
296 |
update_game.click(game_fn,[out_sky_url,out_star_url,out_enemy_url],html_game)
|
297 |
-
btn_sky.click(sky_fn,prompt_sky,[out_im_sky,out_sky_url
|
298 |
-
btn_star.click(star_fn,prompt_star,[out_im_star,out_star_url
|
299 |
-
btn_enemy.click(enemy_fn,prompt_enemy,[out_im_enemy,out_enemy_url
|
300 |
app.load(predict,[text_input,url_params],[text_input,html_game], _js=get_window_url_params)
|
301 |
|
302 |
#app.load(sky_fn,prompt_sky,[out_im_sky,out_sky_url]).then(game_fn,[out_sky_url],html_game)
|
|
|
74 |
out = os.path.abspath(f"{uid}_sky.png")
|
75 |
#out = os.path.abspath(outp)
|
76 |
out_url = f'https://omnibus-game-test.hf.space/file={out}'
|
77 |
+
return outp,out_url
|
78 |
|
79 |
def star_fn(inp):
|
80 |
rand = random.randint(1,200)
|
|
|
88 |
outrs.save(f"{uid}_star.png")
|
89 |
out_file = os.path.abspath(f"{uid}_star.png")
|
90 |
out_url = f'https://omnibus-game-test.hf.space/file={out_file}'
|
91 |
+
return out,out_url
|
92 |
|
93 |
def enemy_fn(inp):
|
94 |
rand = random.randint(1,200)
|
|
|
102 |
outrs.save(f"{uid}_enemy.png")
|
103 |
out_file = os.path.abspath(f"{uid}_enemy.png")
|
104 |
out_url = f'https://omnibus-game-test.hf.space/file={out_file}'
|
105 |
+
return out,out_url
|
106 |
|
107 |
def save_game(name,score):
|
108 |
user_repo=save_data.split('datasets/',1)[1].split('/raw',1)[0]
|
|
|
294 |
get_score.click(return_score,score,[score],_js=score_js)
|
295 |
save_btn.click(return_score,score,[score],_js=score_js).then(save_game,[game_name,score],message)
|
296 |
update_game.click(game_fn,[out_sky_url,out_star_url,out_enemy_url],html_game)
|
297 |
+
btn_sky.click(sky_fn,prompt_sky,[out_im_sky,out_sky_url])
|
298 |
+
btn_star.click(star_fn,prompt_star,[out_im_star,out_star_url])
|
299 |
+
btn_enemy.click(enemy_fn,prompt_enemy,[out_im_enemy,out_enemy_url])
|
300 |
app.load(predict,[text_input,url_params],[text_input,html_game], _js=get_window_url_params)
|
301 |
|
302 |
#app.load(sky_fn,prompt_sky,[out_im_sky,out_sky_url]).then(game_fn,[out_sky_url],html_game)
|