Mario / app.py
Gregniuki's picture
Update app.py
deb8fc1 verified
raw
history blame
779 Bytes
import subprocess
import gradio as gr
# Clone the Mario game repository
def install_package():
subprocess.run(["git", "clone", "https://github.com/reruns/mario.git", "mario"], check=True)
# Install the game files on startup
install_package()
# Read the index.html file
def serve_game():
with open("mario/index.html", "r") as file:
html_content = file.read()
return html_content
# Create a Gradio interface
iface = gr.Interface(
fn=serve_game, # Function to generate the HTML content
inputs=None, # No inputs needed
outputs=gr.HTML(), # Output is HTML content
live=True, # Keep the interface live
title="Mario HTML Game",
description="Play the Mario HTML game embedded in Gradio!"
)
# Launch the Gradio app
iface.launch()