Upload 150 files
Browse files- app.py +34 -7
- demo_images/panorama/thumbnails/_2h2HQiO_LScptNqIlv26g,41.876157,-87.656242,.jpg +0 -0
- demo_images/panorama/thumbnails/_MubtGZKtddAL0UcHHf5Cg,41.861737,-87.644142,.jpg +0 -0
- demo_images/panorama/thumbnails/_U8e_qINb8isqDbFusZadg,41.867593,-87.673364,.jpg +0 -0
- demo_images/panorama/thumbnails/_cF0n90rix962-yUqP13Ow,41.870943,-87.647100,.jpg +0 -0
- demo_images/panorama/thumbnails/default_panorama.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_1.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_10.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_2.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_3.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_4.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_5.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_6.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_7.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_8.jpg +0 -0
- demo_images/satellite/thumbnails/sat_demo_9.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.564866521505394_-122.33116389229833.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.57109989810551_-122.30149079418568.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.57372447772661_-122.30489590380517.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.574380622631885_-122.32192145190258.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.57503676753716_-122.33456900191781.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.576020984895074_-122.31657056535768.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.5779894196109_-122.31608412112634.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.58356665130574_-122.2873839114764.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.59012810035849_-122.32240789613394.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.59111231771641_-122.28981613263318.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.59176846262168_-122.29419413071537.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.595377259600696_-122.32435367305936.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.59767376676916_-122.33651477884322.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.6006264188429_-122.29419413071537.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.60390714336928_-122.31559767689498.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.616373896569506_-122.31024679035008.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.616373896569506_-122.3131654557382.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.618014258832694_-122.29857212879756.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.61867040373797_-122.3024636826484.jpg +0 -0
- demo_images/satellite/thumbnails/satellite_47.62227920071699_-122.29176190955859.jpg +0 -0
app.py
CHANGED
|
@@ -487,6 +487,18 @@ def build_demo():
|
|
| 487 |
sample_sat_images_with_csv = [p for p in sample_sat_images if p.with_suffix(".csv").exists()]
|
| 488 |
sample_sky_pairs, default_sky_path = resolve_demo_sky_pairs(demo_dir)
|
| 489 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
with gr.Blocks(title="Sat3DGen Demo", theme=gr.themes.Soft()) as demo:
|
| 491 |
gr.Markdown(
|
| 492 |
"""
|
|
@@ -524,12 +536,27 @@ def build_demo():
|
|
| 524 |
download_button = gr.DownloadButton("💾 Download Mesh (.obj)", variant="secondary")
|
| 525 |
|
| 526 |
if sample_sat_images:
|
| 527 |
-
gr.Markdown("### Sample Images")
|
| 528 |
-
gr.
|
| 529 |
-
|
| 530 |
-
inputs=[sat_input],
|
| 531 |
label="Click to load a sample satellite image",
|
| 532 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 533 |
)
|
| 534 |
|
| 535 |
gr.Markdown(
|
|
@@ -656,7 +683,7 @@ def build_demo():
|
|
| 656 |
if sample_sat_images_with_csv:
|
| 657 |
gr.Markdown("### 🛰️ Sample Satellite Images — click to load")
|
| 658 |
sat_gallery = gr.Gallery(
|
| 659 |
-
value=[
|
| 660 |
label="Sample Satellite Images (with trajectory)",
|
| 661 |
columns=5,
|
| 662 |
rows=1,
|
|
@@ -681,7 +708,7 @@ def build_demo():
|
|
| 681 |
sky_gallery = gr.Gallery(
|
| 682 |
value=[
|
| 683 |
(
|
| 684 |
-
|
| 685 |
f"{pano_path.name} (Default)" if pano_path == default_sky_path else pano_path.name,
|
| 686 |
)
|
| 687 |
for pano_path, _ in sample_sky_pairs
|
|
|
|
| 487 |
sample_sat_images_with_csv = [p for p in sample_sat_images if p.with_suffix(".csv").exists()]
|
| 488 |
sample_sky_pairs, default_sky_path = resolve_demo_sky_pairs(demo_dir)
|
| 489 |
|
| 490 |
+
# Build thumbnail paths for faster UI loading
|
| 491 |
+
sat_thumb_dir = demo_dir / "satellite" / "thumbnails"
|
| 492 |
+
pano_thumb_dir = demo_dir / "panorama" / "thumbnails"
|
| 493 |
+
|
| 494 |
+
def get_thumbnail(original_path: Path) -> str:
|
| 495 |
+
"""Return thumbnail path if it exists, otherwise fall back to original."""
|
| 496 |
+
thumb_dir = sat_thumb_dir if "satellite" in str(original_path) else pano_thumb_dir
|
| 497 |
+
thumb_path = thumb_dir / (original_path.stem + ".jpg")
|
| 498 |
+
if thumb_path.exists():
|
| 499 |
+
return str(thumb_path)
|
| 500 |
+
return str(original_path)
|
| 501 |
+
|
| 502 |
with gr.Blocks(title="Sat3DGen Demo", theme=gr.themes.Soft()) as demo:
|
| 503 |
gr.Markdown(
|
| 504 |
"""
|
|
|
|
| 536 |
download_button = gr.DownloadButton("💾 Download Mesh (.obj)", variant="secondary")
|
| 537 |
|
| 538 |
if sample_sat_images:
|
| 539 |
+
gr.Markdown("### Sample Images — click to load")
|
| 540 |
+
mesh_sat_gallery = gr.Gallery(
|
| 541 |
+
value=[get_thumbnail(p) for p in sample_sat_images],
|
|
|
|
| 542 |
label="Click to load a sample satellite image",
|
| 543 |
+
columns=5,
|
| 544 |
+
rows=2,
|
| 545 |
+
height=160,
|
| 546 |
+
object_fit="cover",
|
| 547 |
+
allow_preview=False,
|
| 548 |
+
)
|
| 549 |
+
|
| 550 |
+
def load_sat_for_mesh(evt: gr.SelectData):
|
| 551 |
+
"""Load the full-resolution image when a thumbnail is clicked."""
|
| 552 |
+
if evt.index is None or evt.index >= len(sample_sat_images):
|
| 553 |
+
return None
|
| 554 |
+
return Image.open(str(sample_sat_images[evt.index]))
|
| 555 |
+
|
| 556 |
+
mesh_sat_gallery.select(
|
| 557 |
+
fn=load_sat_for_mesh,
|
| 558 |
+
inputs=None,
|
| 559 |
+
outputs=[sat_input],
|
| 560 |
)
|
| 561 |
|
| 562 |
gr.Markdown(
|
|
|
|
| 683 |
if sample_sat_images_with_csv:
|
| 684 |
gr.Markdown("### 🛰️ Sample Satellite Images — click to load")
|
| 685 |
sat_gallery = gr.Gallery(
|
| 686 |
+
value=[get_thumbnail(p) for p in sample_sat_images_with_csv],
|
| 687 |
label="Sample Satellite Images (with trajectory)",
|
| 688 |
columns=5,
|
| 689 |
rows=1,
|
|
|
|
| 708 |
sky_gallery = gr.Gallery(
|
| 709 |
value=[
|
| 710 |
(
|
| 711 |
+
get_thumbnail(pano_path),
|
| 712 |
f"{pano_path.name} (Default)" if pano_path == default_sky_path else pano_path.name,
|
| 713 |
)
|
| 714 |
for pano_path, _ in sample_sky_pairs
|
demo_images/panorama/thumbnails/_2h2HQiO_LScptNqIlv26g,41.876157,-87.656242,.jpg
ADDED
|
|
demo_images/panorama/thumbnails/_MubtGZKtddAL0UcHHf5Cg,41.861737,-87.644142,.jpg
ADDED
|
|
demo_images/panorama/thumbnails/_U8e_qINb8isqDbFusZadg,41.867593,-87.673364,.jpg
ADDED
|
|
demo_images/panorama/thumbnails/_cF0n90rix962-yUqP13Ow,41.870943,-87.647100,.jpg
ADDED
|
|
demo_images/panorama/thumbnails/default_panorama.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_1.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_10.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_2.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_3.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_4.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_5.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_6.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_7.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_8.jpg
ADDED
|
|
demo_images/satellite/thumbnails/sat_demo_9.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.564866521505394_-122.33116389229833.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.57109989810551_-122.30149079418568.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.57372447772661_-122.30489590380517.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.574380622631885_-122.32192145190258.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.57503676753716_-122.33456900191781.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.576020984895074_-122.31657056535768.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.5779894196109_-122.31608412112634.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.58356665130574_-122.2873839114764.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.59012810035849_-122.32240789613394.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.59111231771641_-122.28981613263318.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.59176846262168_-122.29419413071537.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.595377259600696_-122.32435367305936.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.59767376676916_-122.33651477884322.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.6006264188429_-122.29419413071537.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.60390714336928_-122.31559767689498.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.616373896569506_-122.31024679035008.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.616373896569506_-122.3131654557382.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.618014258832694_-122.29857212879756.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.61867040373797_-122.3024636826484.jpg
ADDED
|
|
demo_images/satellite/thumbnails/satellite_47.62227920071699_-122.29176190955859.jpg
ADDED
|
|