Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
|
4 |
+
# Function to serve the Space Invaders game
|
5 |
+
def serve_game():
|
6 |
+
# Read the index.html file
|
7 |
+
with open("index.html", "r") as file:
|
8 |
+
html_content = file.read()
|
9 |
+
return html_content
|
10 |
+
|
11 |
+
# Create a Gradio interface
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=serve_game, # Function to generate the HTML content
|
14 |
+
inputs=None, # No inputs needed
|
15 |
+
outputs=gr.HTML(), # Output is HTML content
|
16 |
+
live=True, # Keep the interface live
|
17 |
+
title="Space Invaders Game",
|
18 |
+
description="Play Space Invaders in your browser!"
|
19 |
+
)
|
20 |
+
|
21 |
+
# Launch the Gradio app
|
22 |
+
iface.launch()
|