Spaces:
Running on Zero
Running on Zero
Serve the page when Hugging Face adds a query string
Browse files- docparse/ui.py +2 -1
docparse/ui.py
CHANGED
|
@@ -23,7 +23,8 @@ def serve(port=7862, host="127.0.0.1", model=None):
|
|
| 23 |
self.wfile.write(data)
|
| 24 |
|
| 25 |
def do_GET(self):
|
| 26 |
-
|
|
|
|
| 27 |
self._send(200, PAGE.read_bytes(), "text/html; charset=utf-8")
|
| 28 |
else:
|
| 29 |
self._send(404, json.dumps({"error": "not found"}))
|
|
|
|
| 23 |
self.wfile.write(data)
|
| 24 |
|
| 25 |
def do_GET(self):
|
| 26 |
+
# ignore the query string: Hugging Face embeds the page as /?__theme=dark etc.
|
| 27 |
+
if self.path.split("?", 1)[0] in ("/", "/index.html"):
|
| 28 |
self._send(200, PAGE.read_bytes(), "text/html; charset=utf-8")
|
| 29 |
else:
|
| 30 |
self._send(404, json.dumps({"error": "not found"}))
|