Download scripts/serve.py from dl4eo/object-detection-optical-satellite: direct link, hf CLI and curl.
- Browser
- Download file 743 Bytes
-
https://huggingface.co/spaces/dl4eo/object-detection-optical-satellite/resolve/main/scripts/serve.py
- Command line
-
hf download hf://spaces/dl4eo/object-detection-optical-satellite/scripts/serve.py
-
curl -L -o serve.py https://huggingface.co/spaces/dl4eo/object-detection-optical-satellite/resolve/main/scripts/serve.py
743 Bytes
| #!/usr/bin/env python3 | |
| """Local static server with Cache-Control: no-store (port 7860).""" | |
| from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer | |
| PORT = 7860 | |
| class NoCacheHandler(SimpleHTTPRequestHandler): | |
| def end_headers(self) -> None: | |
| self.send_header("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0") | |
| self.send_header("Pragma", "no-cache") | |
| self.send_header("Expires", "0") | |
| super().end_headers() | |
| if __name__ == "__main__": | |
| httpd = ThreadingHTTPServer(("127.0.0.1", PORT), NoCacheHandler) | |
| print(f"Serving on http://127.0.0.1:{PORT} (no-cache)") | |
| try: | |
| httpd.serve_forever() | |
| except KeyboardInterrupt: | |
| print() | |
| httpd.server_close() | |