Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -534,6 +534,16 @@ with gr.Blocks(title="DepthForge") as demo:
|
|
| 534 |
with gr.Row():
|
| 535 |
with gr.Column(scale=1):
|
| 536 |
input_image = gr.Image(type="pil", label="Upload a photo", sources=["upload", "clipboard"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 537 |
model_choice = gr.Radio(
|
| 538 |
choices=["GLPN (Recommended)", "DPT (High Quality)"],
|
| 539 |
value="GLPN (Recommended)", label="Depth model",
|
|
@@ -558,16 +568,18 @@ with gr.Blocks(title="DepthForge") as demo:
|
|
| 558 |
inputs=[input_image, model_choice, visualization_type, consent_checkbox],
|
| 559 |
outputs=[depth_output, viewer_3d, download_output, metrics_output, json_output])
|
| 560 |
|
| 561 |
-
# ββ
|
| 562 |
-
with gr.Tab("πΌοΈ
|
| 563 |
gr.Markdown("""
|
| 564 |
-
##
|
| 565 |
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
|
|
|
|
|
|
| 571 |
""")
|
| 572 |
|
| 573 |
with gr.Row(equal_height=False):
|
|
@@ -589,8 +601,7 @@ straight into the Reconstruct tab, then hit βΆ Reconstruct.
|
|
| 589 |
<span class="sample-pill good">β indoor scene</span>
|
| 590 |
</div>
|
| 591 |
""")
|
| 592 |
-
gr.Image(value=SAMPLE_INDOOR, label="
|
| 593 |
-
load_indoor_btn = gr.Button("Load Sample 1 into Reconstruct tab", variant="secondary")
|
| 594 |
|
| 595 |
# ββ Sample 2 ββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 596 |
with gr.Column():
|
|
@@ -610,8 +621,7 @@ straight into the Reconstruct tab, then hit βΆ Reconstruct.
|
|
| 610 |
<span class="sample-pill good">β switch to DPT here</span>
|
| 611 |
</div>
|
| 612 |
""")
|
| 613 |
-
gr.Image(value=SAMPLE_OUTDOOR, label="
|
| 614 |
-
load_outdoor_btn = gr.Button("Load Sample 2 into Reconstruct tab", variant="secondary")
|
| 615 |
|
| 616 |
gr.Markdown("""
|
| 617 |
---
|
|
@@ -630,10 +640,6 @@ straight into the Reconstruct tab, then hit βΆ Reconstruct.
|
|
| 630 |
> flag are the fastest way to judge which model suited the scene better.
|
| 631 |
""")
|
| 632 |
|
| 633 |
-
# wire buttons β loads PIL image into the uploader on Reconstruct tab
|
| 634 |
-
load_indoor_btn.click(fn=lambda: SAMPLE_INDOOR, inputs=[], outputs=[input_image])
|
| 635 |
-
load_outdoor_btn.click(fn=lambda: SAMPLE_OUTDOOR, inputs=[], outputs=[input_image])
|
| 636 |
-
|
| 637 |
# ββ Theory ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 638 |
with gr.Tab("π Theory & Background"):
|
| 639 |
gr.Markdown("""
|
|
@@ -685,10 +691,11 @@ multiple cameras, no manual modelling.
|
|
| 685 |
gr.Markdown("""
|
| 686 |
## How to Use This Application
|
| 687 |
|
| 688 |
-
### First time? Use
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
a minute
|
|
|
|
| 692 |
|
| 693 |
### Step 1 Β· Read the guidelines
|
| 694 |
The **β οΈ Responsible Use** tab explains privacy rules, prohibited uses,
|
|
|
|
| 534 |
with gr.Row():
|
| 535 |
with gr.Column(scale=1):
|
| 536 |
input_image = gr.Image(type="pil", label="Upload a photo", sources=["upload", "clipboard"])
|
| 537 |
+
|
| 538 |
+
# Click a sample thumbnail to load it straight into the
|
| 539 |
+
# uploader above β no tab switching needed.
|
| 540 |
+
gr.Examples(
|
| 541 |
+
examples=[[SAMPLE_INDOOR_PATH], [SAMPLE_OUTDOOR_PATH]],
|
| 542 |
+
inputs=[input_image],
|
| 543 |
+
label="No image? Click a sample to try it instantly",
|
| 544 |
+
examples_per_page=2,
|
| 545 |
+
)
|
| 546 |
+
|
| 547 |
model_choice = gr.Radio(
|
| 548 |
choices=["GLPN (Recommended)", "DPT (High Quality)"],
|
| 549 |
value="GLPN (Recommended)", label="Depth model",
|
|
|
|
| 568 |
inputs=[input_image, model_choice, visualization_type, consent_checkbox],
|
| 569 |
outputs=[depth_output, viewer_3d, download_output, metrics_output, json_output])
|
| 570 |
|
| 571 |
+
# ββ Sample Guide βββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 572 |
+
with gr.Tab("πΌοΈ Sample Guide"):
|
| 573 |
gr.Markdown("""
|
| 574 |
+
## About the two sample images
|
| 575 |
|
| 576 |
+
You don't need to come to this tab to use the samples β they're available as
|
| 577 |
+
clickable thumbnails right under the uploader on the **π¬ Reconstruct** tab.
|
| 578 |
+
Click one there and it loads instantly, no switching back and forth.
|
| 579 |
+
|
| 580 |
+
This page just explains what each sample is for and how to read the results.
|
| 581 |
+
The two are a deliberate side-by-side: **Sample 1** shows the model at its
|
| 582 |
+
best, **Sample 2** shows where it struggles and when to switch models.
|
| 583 |
""")
|
| 584 |
|
| 585 |
with gr.Row(equal_height=False):
|
|
|
|
| 601 |
<span class="sample-pill good">β indoor scene</span>
|
| 602 |
</div>
|
| 603 |
""")
|
| 604 |
+
gr.Image(value=SAMPLE_INDOOR, label="Sample 1 preview", interactive=False)
|
|
|
|
| 605 |
|
| 606 |
# ββ Sample 2 ββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 607 |
with gr.Column():
|
|
|
|
| 621 |
<span class="sample-pill good">β switch to DPT here</span>
|
| 622 |
</div>
|
| 623 |
""")
|
| 624 |
+
gr.Image(value=SAMPLE_OUTDOOR, label="Sample 2 preview", interactive=False)
|
|
|
|
| 625 |
|
| 626 |
gr.Markdown("""
|
| 627 |
---
|
|
|
|
| 640 |
> flag are the fastest way to judge which model suited the scene better.
|
| 641 |
""")
|
| 642 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 643 |
# ββ Theory ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 644 |
with gr.Tab("π Theory & Background"):
|
| 645 |
gr.Markdown("""
|
|
|
|
| 691 |
gr.Markdown("""
|
| 692 |
## How to Use This Application
|
| 693 |
|
| 694 |
+
### First time? Use a sample
|
| 695 |
+
On the **π¬ Reconstruct** tab, tick the consent box, then click one of the
|
| 696 |
+
sample thumbnails under the uploader. It loads instantly β hit βΆ Reconstruct
|
| 697 |
+
and you'll have a result in under a minute, no image of your own needed.
|
| 698 |
+
(See the **πΌοΈ Sample Guide** tab for what each sample demonstrates.)
|
| 699 |
|
| 700 |
### Step 1 Β· Read the guidelines
|
| 701 |
The **β οΈ Responsible Use** tab explains privacy rules, prohibited uses,
|