3hstack commited on
Commit
8f17b5a
·
verified ·
1 Parent(s): 12ecccb

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +4 -1
  2. README.md +6 -6
  3. app.py +4 -3
Dockerfile CHANGED
@@ -1,11 +1,13 @@
1
  FROM python:3.11-slim
2
 
 
3
  RUN apt-get update && apt-get install -y --no-install-recommends \
4
  build-essential \
5
  && rm -rf /var/lib/apt/lists/*
6
 
7
  WORKDIR /app
8
 
 
9
  RUN pip install --no-cache-dir \
10
  flask==3.0.3 \
11
  gunicorn==22.0.0 \
@@ -17,6 +19,7 @@ RUN pip install --no-cache-dir \
17
 
18
  COPY app.py .
19
 
 
20
  ENV HOME=/tmp \
21
  MPLCONFIGDIR=/tmp/mpl \
22
  XDG_CACHE_HOME=/tmp/cache \
@@ -25,4 +28,4 @@ ENV HOME=/tmp \
25
 
26
  EXPOSE 7860
27
 
28
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "--timeout", "300", "app:app"]
 
1
  FROM python:3.11-slim
2
 
3
+ # osmnx pulls geopandas/pyproj/rtree; slim needs a C toolchain for a couple of them.
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  build-essential \
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
  WORKDIR /app
9
 
10
+ # Deps are inlined on purpose -- no requirements.txt to go missing on upload.
11
  RUN pip install --no-cache-dir \
12
  flask==3.0.3 \
13
  gunicorn==22.0.0 \
 
19
 
20
  COPY app.py .
21
 
22
+ # HF Spaces run as a non-root user; only /tmp is writable.
23
  ENV HOME=/tmp \
24
  MPLCONFIGDIR=/tmp/mpl \
25
  XDG_CACHE_HOME=/tmp/cache \
 
28
 
29
  EXPOSE 7860
30
 
31
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "--timeout", "300", "app:app"]
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Route Em
3
- emoji: 📰
4
  colorFrom: blue
5
  colorTo: indigo
6
  sdk: docker
@@ -9,7 +9,7 @@ pinned: false
9
  license: mit
10
  ---
11
 
12
- # Paper Route Planner
13
 
14
  Finds the **shortest closed route that covers every road, both sides** — the route you'd
15
  drive or walk to put a paper on every doorstep.
@@ -58,10 +58,10 @@ returning anything.
58
  ## Deploy your own
59
 
60
  ```bash
61
- git clone https://huggingface.co/spaces/<you>/paper-route-planner
62
- cd paper-route-planner
63
- # copy app.py, Dockerfile, requirements.txt, README.md in
64
- git add . && git commit -m "Paper route planner" && git push
65
  ```
66
 
67
  The Space builds itself from the Dockerfile. First build takes a few minutes (geopandas).
 
1
  ---
2
  title: Route Em
3
+ emoji: 🗺️
4
  colorFrom: blue
5
  colorTo: indigo
6
  sdk: docker
 
9
  license: mit
10
  ---
11
 
12
+ # Route Em
13
 
14
  Finds the **shortest closed route that covers every road, both sides** — the route you'd
15
  drive or walk to put a paper on every doorstep.
 
58
  ## Deploy your own
59
 
60
  ```bash
61
+ git clone https://huggingface.co/spaces/<you>/route-em
62
+ cd route-em
63
+ # copy app.py, Dockerfile, README.md in (deps are inlined in the Dockerfile)
64
+ git add . && git commit -m "Route Em" && git push
65
  ```
66
 
67
  The Space builds itself from the Dockerfile. First build takes a few minutes (geopandas).
app.py CHANGED
@@ -1,6 +1,6 @@
1
  #!/usr/bin/env python3
2
  """
3
- Paper Route Planner -- Hugging Face Space (Docker SDK).
4
 
5
  Shortest closed route covering every road on BOTH sides -- the route you would
6
  drive or walk to put a paper on every doorstep. Directed Chinese Postman Problem
@@ -301,7 +301,8 @@ PAGE = r'''<!DOCTYPE html>
301
  <html lang="en">
302
  <head>
303
  <meta charset="utf-8">
304
- <title>Paper Route Planner</title>
 
305
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css">
306
  <link rel="stylesheet" href="https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css">
307
  <style>
@@ -351,7 +352,7 @@ PAGE = r'''<!DOCTYPE html>
351
  <body>
352
 
353
  <header>
354
- <h1>Paper Route Planner</h1>
355
  <span class="sub">Shortest closed route covering every road &mdash; both sides &mdash; solved exactly (Directed Chinese Postman)</span>
356
  </header>
357
 
 
1
  #!/usr/bin/env python3
2
  """
3
+ Route Em -- Hugging Face Space (Docker SDK).
4
 
5
  Shortest closed route covering every road on BOTH sides -- the route you would
6
  drive or walk to put a paper on every doorstep. Directed Chinese Postman Problem
 
301
  <html lang="en">
302
  <head>
303
  <meta charset="utf-8">
304
+ <title>Route Em</title>
305
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2213%22%20fill%3D%22%230f1115%22%2F%3E%3Cpath%20d%3D%22M8%2017%2022%2012%2042%2019%2056%2013%2056%2047%2042%2053%2022%2046%208%2051Z%22%20fill%3D%22%23232a36%22%2F%3E%3Cpath%20d%3D%22M8%2017%2022%2012%2042%2019%2056%2013%2056%2024%2042%2030%2022%2023%208%2028Z%22%20fill%3D%22%232b3342%22%2F%3E%3Cpath%20d%3D%22M22%2012%2022%2046M42%2019%2042%2053%22%20stroke%3D%22%230f1115%22%20stroke-width%3D%221.6%22%20opacity%3D%22.85%22%2F%3E%3Cpath%20d%3D%22M15%2044%20Q17%2033%2027%2033%20Q38%2033%2037%2024%20Q36%2017%2047%2019%22%20fill%3D%22none%22%20stroke%3D%22%234f8cff%22%20stroke-width%3D%224.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Ccircle%20cx%3D%2215%22%20cy%3D%2244%22%20r%3D%224.4%22%20fill%3D%22%232ecc71%22%20stroke%3D%22%230f1115%22%20stroke-width%3D%221.6%22%2F%3E%3Ccircle%20cx%3D%2247%22%20cy%3D%2219%22%20r%3D%224.4%22%20fill%3D%22%23e6c85a%22%20stroke%3D%22%230f1115%22%20stroke-width%3D%221.6%22%2F%3E%3C%2Fsvg%3E">
306
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css">
307
  <link rel="stylesheet" href="https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css">
308
  <style>
 
352
  <body>
353
 
354
  <header>
355
+ <h1>Route Em</h1>
356
  <span class="sub">Shortest closed route covering every road &mdash; both sides &mdash; solved exactly (Directed Chinese Postman)</span>
357
  </header>
358