game-test / app.py
Omnibus's picture
Update app.py
ebfe479
raw
history blame
1.64 kB
import gradio as gr
#sky = "https://huggingface.co/spaces/Omnibus/game-test/resolve/main/assets/sky.png"
sky="https%3A%2F%2Fhuggingface.co%2Fspaces%2FOmnibus%2Fgame-test%2Fresolve%2Fmain%2Fassets%2Fsky.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'
load_js=f"""
var sky_img = {sky};
var platform_img = {platform};
var star_img = {star};
var bomb_img = {bomb};
var dude_img = {dude};
let myIframe = document.getElementById("myIframe");
let url_string = "https://omnibus-game-test-static.static.hf.space";
let adsURL = url_string+"?sky="+sky_img+"&platform="+platform_img;
console.log(adsURL);
myIframe.src = adsURL;
"""
# src="https://omnibus-game-test-static.static.hf.space?sky={sky}&platform={platform}&star={star}&bomb={bomb}&dude={dude}"
html_mod=f"""
<div id="demo">
<iframe
id="myIframe"
src="https://omnibus-game-test-static.static.hf.space?sky={sky}&platform={platform}&star={star}&bomb={bomb}&dude={dude}"
frameborder="0"
width="100%"
height="100%"
></iframe>
</div>"""
with open("tmp.html","w") as f:
f.write(html_mod)
f.close
with open("tmp.html","r") as f:
out = f.read()
print(out)
with gr.Blocks() as app:
gr.HTML(out)
btn=gr.Button()
btn.click(None,None,None)
app.launch()