Gregniuki commited on
Commit
9d0e62f
·
verified ·
1 Parent(s): e7efbe3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -11,14 +11,16 @@ def install_flask():
11
 
12
  # Install Flask on startup
13
  install_flask()
14
-
 
 
15
  # Now import Flask
16
  from flask import Flask, send_from_directory
17
 
18
  # Clone the Mario game repository
19
  def install_package():
20
  subprocess.run(["git", "clone", "https://github.com/reruns/mario.git", "mario"], check=True)
21
-
22
  # Install the game files on startup
23
  install_package()
24
 
@@ -33,8 +35,8 @@ def serve_static(path):
33
  # Read the index.html file
34
 
35
  def serve_game():
36
- return '<iframe src="mario/index.html" width="800" height="600"></iframe>'
37
-
38
  # Create a Gradio interface
39
  iface = gr.Interface(
40
  fn=serve_game, # Function to generate the HTML content
 
11
 
12
  # Install Flask on startup
13
  install_flask()
14
+ @flask_app.route("/mario")
15
+ def serve_index():
16
+ return send_from_directory("mario", "index.html")
17
  # Now import Flask
18
  from flask import Flask, send_from_directory
19
 
20
  # Clone the Mario game repository
21
  def install_package():
22
  subprocess.run(["git", "clone", "https://github.com/reruns/mario.git", "mario"], check=True)
23
+ return "http://localhost:7860/mario" # Local URL (Change port if needed)
24
  # Install the game files on startup
25
  install_package()
26
 
 
35
  # Read the index.html file
36
 
37
  def serve_game():
38
+ game_url = "http://localhost:7860/mario" # Or from install_package()
39
+ return f'<iframe src="{game_url}" width="800" height="600"></iframe>'
40
  # Create a Gradio interface
41
  iface = gr.Interface(
42
  fn=serve_game, # Function to generate the HTML content