Spaces:
Paused
Paused
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from fastapi.staticfiles import StaticFiles
|
| 3 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
# Create Gradio interface
|
| 7 |
+
with gr.Blocks(title="SkyData Game Server") as demo:
|
| 8 |
+
gr.Markdown("# 🌍 SkyData Game Server is Running")
|
| 9 |
+
gr.Markdown("Status: **Active & Serving Assets**")
|
| 10 |
+
|
| 11 |
+
app = demo.app
|
| 12 |
+
|
| 13 |
+
# Enable CORS for cross-origin requests from game.html
|
| 14 |
+
app.add_middleware(
|
| 15 |
+
CORSMiddleware,
|
| 16 |
+
allow_origins=["*"],
|
| 17 |
+
allow_credentials=True,
|
| 18 |
+
allow_methods=["*"],
|
| 19 |
+
allow_headers=["*"],
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Mount country_flags directory
|
| 23 |
+
if os.path.exists("country_flags"):
|
| 24 |
+
app.mount("/country_flags", StaticFiles(directory="country_flags"), name="country_flags")
|
| 25 |
+
|
| 26 |
+
# Mount textures directory
|
| 27 |
+
if os.path.exists("textures"):
|
| 28 |
+
app.mount("/textures", StaticFiles(directory="textures"), name="textures")
|
| 29 |
+
|
| 30 |
+
if __name__ == "__main__":
|
| 31 |
+
demo.launch()
|