CoolFace
Apppublic

miya3333/DiscoveringNumbersGame

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
app.py16 linesDownload Raw Back to root
1import http.server2import socketserver3import os4 5# Define the port Spaces expects applications to run on6PORT = int(os.environ.get("PORT", 7860))7DIRECTORY = "."8 9class Handler(http.server.SimpleHTTPRequestHandler):10    def __init__(self, *args, **kwargs):11        super().__init__(*args, directory=DIRECTORY, **kwargs)12 13with socketserver.TCPServer(("", PORT), Handler) as httpd:14    print(f"Serving directory {DIRECTORY} at port {PORT}")15    httpd.serve_forever()16