Gregniuki commited on
Commit
deb8fc1
·
verified ·
1 Parent(s): d9c1366

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import gradio as gr
3
+
4
+ # Clone the Mario game repository
5
+ def install_package():
6
+ subprocess.run(["git", "clone", "https://github.com/reruns/mario.git", "mario"], check=True)
7
+
8
+ # Install the game files on startup
9
+ install_package()
10
+
11
+ # Read the index.html file
12
+ def serve_game():
13
+ with open("mario/index.html", "r") as file:
14
+ html_content = file.read()
15
+ return html_content
16
+
17
+ # Create a Gradio interface
18
+ iface = gr.Interface(
19
+ fn=serve_game, # Function to generate the HTML content
20
+ inputs=None, # No inputs needed
21
+ outputs=gr.HTML(), # Output is HTML content
22
+ live=True, # Keep the interface live
23
+ title="Mario HTML Game",
24
+ description="Play the Mario HTML game embedded in Gradio!"
25
+ )
26
+
27
+ # Launch the Gradio app
28
+ iface.launch()