Omnibus commited on
Commit
1bef23c
1 Parent(s): 40b07e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -9,31 +9,33 @@ star = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/star
9
  bomb = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/bomb.png'
10
  dude = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/dude.png'
11
 
12
-
13
- html_mod=f"""
14
- <div id="demo" style="height:600px">
15
- <iframe
16
- id="myIframe"
17
- src="https://omnibus-game-test-static.static.hf.space/index.html?sky={sky}&platform={platform}&star={star}&bomb={bomb}&dude={dude}"
18
- frameborder="0"
19
- width="100%"
20
- height="100%"
21
- ></iframe>
22
- </div>"""
 
23
 
24
  def dif_fn(inp):
25
  output=diff.send_it(inp,5,1)
26
  return output[0]
27
 
28
-
29
-
30
  with gr.Blocks() as app:
31
  with gr.Row():
32
  with gr.Column():
33
  prompt=gr.Textbox()
34
- btn=gr.Button()
 
 
35
  out_im=gr.Image()
36
-
37
- gr.HTML(html_mod)
38
  btn.click(dif_fn,prompt,out_im)
 
39
  app.launch()
 
9
  bomb = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/bomb.png'
10
  dude = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/dude.png'
11
 
12
+ def game_fn(sky=sky,platform=platform,star=star,bomb=bomb,dude=dude)
13
+ html_mod=f"""
14
+ <div id="demo" style="height:600px">
15
+ <iframe
16
+ id="myIframe"
17
+ src="https://omnibus-game-test-static.static.hf.space/index.html?sky={sky}&platform={platform}&star={star}&bomb={bomb}&dude={dude}"
18
+ frameborder="0"
19
+ width="100%"
20
+ height="100%"
21
+ ></iframe>
22
+ </div>"""
23
+ return html_mod
24
 
25
  def dif_fn(inp):
26
  output=diff.send_it(inp,5,1)
27
  return output[0]
28
 
 
 
29
  with gr.Blocks() as app:
30
  with gr.Row():
31
  with gr.Column():
32
  prompt=gr.Textbox()
33
+ with gr.Row():
34
+ btn=gr.Button("Make Image")
35
+ game_btn=gr.Button("Use Image")
36
  out_im=gr.Image()
37
+ game_btn.click(game_fn,[out_im],html_game)
38
+ html_game = gr.HTML(html_mod)
39
  btn.click(dif_fn,prompt,out_im)
40
+ app.load(game_fn,None,html_game)
41
  app.launch()