Spaces:
Running
Running
gradio ready for updates
Browse files
app.py
CHANGED
|
@@ -153,7 +153,9 @@ def generate(
|
|
| 153 |
map_format,
|
| 154 |
orientation,
|
| 155 |
buildings_enabled,
|
| 156 |
-
railroads_enabled,
|
|
|
|
|
|
|
| 157 |
):
|
| 158 |
"""
|
| 159 |
Run the poster script and stream logs into the UI.
|
|
@@ -189,6 +191,13 @@ def generate(
|
|
| 189 |
if railroads_enabled:
|
| 190 |
cmd += ["--railroads"]
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
# Center selection
|
| 193 |
if center_mode == "Coordinates":
|
| 194 |
if lat is None or lon is None:
|
|
@@ -281,17 +290,16 @@ def on_center_mode_change(mode):
|
|
| 281 |
|
| 282 |
|
| 283 |
with gr.Blocks(css=APP_CSS) as demo:
|
| 284 |
-
|
| 285 |
gr.Markdown(
|
| 286 |
"""
|
| 287 |
# MapToPoster – Gradio
|
| 288 |
-
|
| 289 |
Original project by Ankur (MapToPoster)
|
| 290 |
Based on the open-source repository: https://github.com/originalankur/maptoposter
|
| 291 |
Many thanks for the original work and inspiration.
|
| 292 |
"""
|
| 293 |
)
|
| 294 |
|
|
|
|
| 295 |
center_mode = gr.Radio(
|
| 296 |
label="Center",
|
| 297 |
choices=["City", "Coordinates"],
|
|
@@ -373,6 +381,16 @@ with gr.Blocks(css=APP_CSS) as demo:
|
|
| 373 |
value="portrait",
|
| 374 |
)
|
| 375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
map_format.change(
|
| 377 |
on_format_change,
|
| 378 |
inputs=[map_format],
|
|
@@ -393,7 +411,9 @@ with gr.Blocks(css=APP_CSS) as demo:
|
|
| 393 |
theme, preset, distance, fast_mode,
|
| 394 |
map_format, orientation,
|
| 395 |
buildings,
|
| 396 |
-
railroads,
|
|
|
|
|
|
|
| 397 |
],
|
| 398 |
outputs=[status, out],
|
| 399 |
# leave default queuing behavior for the heavy job
|
|
|
|
| 153 |
map_format,
|
| 154 |
orientation,
|
| 155 |
buildings_enabled,
|
| 156 |
+
railroads_enabled,
|
| 157 |
+
text_fade,
|
| 158 |
+
margins_enabled,
|
| 159 |
):
|
| 160 |
"""
|
| 161 |
Run the poster script and stream logs into the UI.
|
|
|
|
| 191 |
if railroads_enabled:
|
| 192 |
cmd += ["--railroads"]
|
| 193 |
|
| 194 |
+
if text_fade:
|
| 195 |
+
cmd += ["--text-fade"]
|
| 196 |
+
|
| 197 |
+
# Margins/fading logic (NEW)
|
| 198 |
+
if not margins_enabled:
|
| 199 |
+
cmd += ["--no-margins"]
|
| 200 |
+
|
| 201 |
# Center selection
|
| 202 |
if center_mode == "Coordinates":
|
| 203 |
if lat is None or lon is None:
|
|
|
|
| 290 |
|
| 291 |
|
| 292 |
with gr.Blocks(css=APP_CSS) as demo:
|
|
|
|
| 293 |
gr.Markdown(
|
| 294 |
"""
|
| 295 |
# MapToPoster – Gradio
|
|
|
|
| 296 |
Original project by Ankur (MapToPoster)
|
| 297 |
Based on the open-source repository: https://github.com/originalankur/maptoposter
|
| 298 |
Many thanks for the original work and inspiration.
|
| 299 |
"""
|
| 300 |
)
|
| 301 |
|
| 302 |
+
|
| 303 |
center_mode = gr.Radio(
|
| 304 |
label="Center",
|
| 305 |
choices=["City", "Coordinates"],
|
|
|
|
| 381 |
value="portrait",
|
| 382 |
)
|
| 383 |
|
| 384 |
+
text_fade = gr.Checkbox(
|
| 385 |
+
label="Fade under text (improves readability)",
|
| 386 |
+
value=True
|
| 387 |
+
)
|
| 388 |
+
|
| 389 |
+
margins = gr.Checkbox(
|
| 390 |
+
label="Margins & edge fading (coastal frame + inland fade)",
|
| 391 |
+
value=True
|
| 392 |
+
)
|
| 393 |
+
|
| 394 |
map_format.change(
|
| 395 |
on_format_change,
|
| 396 |
inputs=[map_format],
|
|
|
|
| 411 |
theme, preset, distance, fast_mode,
|
| 412 |
map_format, orientation,
|
| 413 |
buildings,
|
| 414 |
+
railroads,
|
| 415 |
+
text_fade,
|
| 416 |
+
margins,
|
| 417 |
],
|
| 418 |
outputs=[status, out],
|
| 419 |
# leave default queuing behavior for the heavy job
|