Download app.py from LatestURL/api: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/spaces/LatestURL/api/resolve/main/app.py
- Command line
-
hf download hf://spaces/LatestURL/api/app.py
-
curl -L -o app.py https://huggingface.co/spaces/LatestURL/api/resolve/main/app.py
607 Bytes
| import os | |
| import subprocess | |
| from http.server import HTTPServer, BaseHTTPRequestHandler | |
| import threading | |
| CMD_SERVER = os.getenv("CMD") | |
| # FgsiDev Script | |
| def start_local_server(): | |
| print(f"🚀 Menjalankan: {CMD_SERVER}") | |
| os.system(f"{CMD_SERVER}") | |
| threading.Thread(target=start_local_server, daemon=True).start() | |
| class Handler(BaseHTTPRequestHandler): | |
| def do_GET(self): | |
| self.send_response(200) | |
| self.send_header("Content-type", "text/plain") | |
| self.end_headers() | |
| self.wfile.write(b"Hello World") | |
| httpd = HTTPServer(('0.0.0.0', 3000), Handler) | |
| httpd.serve_forever() |