Update app.py
Browse files
app.py
CHANGED
@@ -171,7 +171,15 @@ def save_game(background_img,star_img,enemy_img,platform_img,dude_img):
|
|
171 |
except Exception as e:
|
172 |
print (e)
|
173 |
pass
|
|
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
with gr.Blocks() as app:
|
177 |
with gr.Row():
|
@@ -197,8 +205,13 @@ with gr.Blocks() as app:
|
|
197 |
update_game=gr.Button("Make Game")
|
198 |
#start_prompt=gr.Textbox(value="beautiful landscape, real, 8k",visible=False)
|
199 |
html_game = gr.HTML()
|
200 |
-
save_btn=gr.Button("Save
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
202 |
save_btn.click(save_game,[out_im_sky,out_im_star,out_im_enemy,out_im_enemy,out_im_enemy],None)
|
203 |
update_game.click(game_fn,[out_sky_url,out_star_url,out_enemy_url],html_game)
|
204 |
btn_sky.click(sky_fn,prompt_sky,[out_im_sky,out_sky_url])
|
|
|
171 |
except Exception as e:
|
172 |
print (e)
|
173 |
pass
|
174 |
+
score_js="""
|
175 |
|
176 |
+
function(text_input) {
|
177 |
+
var iframe = document.getElementById("myFrame");
|
178 |
+
var elmnt = iframe.contentWindow.document.getElementsByTagName("H1")[0];
|
179 |
+
text_input = Object.fromEntries(elmnt);
|
180 |
+
return [text_input];
|
181 |
+
}
|
182 |
+
"""
|
183 |
|
184 |
with gr.Blocks() as app:
|
185 |
with gr.Row():
|
|
|
205 |
update_game=gr.Button("Make Game")
|
206 |
#start_prompt=gr.Textbox(value="beautiful landscape, real, 8k",visible=False)
|
207 |
html_game = gr.HTML()
|
208 |
+
save_btn=gr.Button("Save")
|
209 |
+
get_score=gr.Button("Get Score")
|
210 |
+
text_input=gr.Textbox()
|
211 |
+
def return_score(text):
|
212 |
+
|
213 |
+
return text
|
214 |
+
get_score.click(return_score,text_input,text_input,_js=score_js)
|
215 |
save_btn.click(save_game,[out_im_sky,out_im_star,out_im_enemy,out_im_enemy,out_im_enemy],None)
|
216 |
update_game.click(game_fn,[out_sky_url,out_star_url,out_enemy_url],html_game)
|
217 |
btn_sky.click(sky_fn,prompt_sky,[out_im_sky,out_sky_url])
|