game-test / app.py
Omnibus's picture
Update app.py
2e84177
raw
history blame
1.43 kB
import gradio as gr
import diff
sky = "https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/sky.png"
platform = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/platform.png'
star = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/star.png'
bomb = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/bomb.png'
dude = 'https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/dude.png'
def game_fn(sky=sky,platform=platform,star=star,bomb=bomb,dude=dude):
html_mod=f"""
<div id="demo" style="height:600px">
<iframe
id="myIframe"
src="https://omnibus-game-test-static.static.hf.space/index.html?sky={sky}&platform={platform}&star={star}&bomb={bomb}&dude={dude}"
frameborder="0"
width="100%"
height="100%"
></iframe>
</div>"""
return html_mod
def dif_fn(inp):
output=diff.send_it(inp,5,1)
return output[0]
with gr.Blocks() as app:
with gr.Row():
with gr.Column():
prompt=gr.Textbox()
with gr.Row():
btn=gr.Button("Make Image")
game_btn=gr.Button("Use Image")
out_im=gr.Image(type='filepath')
html_game = gr.HTML()
game_btn.click(game_fn,[out_im],html_game)
btn.click(dif_fn,prompt,out_im)
app.load(game_fn,None,html_game)
app.launch()