prithivMLmods commited on
Commit
d0ef789
Β·
verified Β·
1 Parent(s): a745165

update app

Browse files
Files changed (1) hide show
  1. app.py +84 -4
app.py CHANGED
@@ -41,6 +41,78 @@ from mapanything.utils.hf_utils.hf_helpers import initialize_mapanything_model
41
  from mapanything.utils.hf_utils.viz import predictions_to_glb
42
  from mapanything.utils.image import load_images, rgb
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  high_level_config = {
45
  "path": "configs/train.yaml",
46
  "hf_model_name": "facebook/map-anything-v1",
@@ -749,12 +821,20 @@ CUSTOM_CSS = (GRADIO_CSS or "") + """
749
 
750
  /* ── Measure note ── */
751
  .measure-note { font-size: 0.78rem !important; opacity: 0.6 !important; margin-top: 6px !important; }
 
 
 
 
 
 
 
 
752
  """
753
 
754
  # -------------------------------------------------------------------------
755
  # 6) Build Gradio UI
756
  # -------------------------------------------------------------------------
757
- with gr.Blocks(css=CUSTOM_CSS) as demo:
758
 
759
  # Hidden state
760
  is_example = gr.Textbox(visible=False, value="None")
@@ -766,8 +846,8 @@ with gr.Blocks(css=CUSTOM_CSS) as demo:
766
  # ── Header ──────────────────────────────────────────────────────────
767
  with gr.Column(elem_id="app-shell"):
768
  with gr.Column(elem_id="app-header"):
769
- gr.Markdown("# **Map-Anything-v1**")
770
- gr.Markdown("Metric 3D Reconstruction (Point Cloud and Camera Poses)")
771
 
772
  # ── Main two-column layout ───────────────────────────────────────
773
  with gr.Row(equal_height=False):
@@ -1064,4 +1144,4 @@ with gr.Blocks(css=CUSTOM_CSS) as demo:
1064
  outputs=[measure_image, measure_points_state],
1065
  )
1066
 
1067
- demo.queue(max_size=20).launch(css=CUSTOM_CSS, show_error=True, share=True, ssr_mode=False)
 
41
  from mapanything.utils.hf_utils.viz import predictions_to_glb
42
  from mapanything.utils.image import load_images, rgb
43
 
44
+ from typing import Iterable
45
+ from gradio.themes import Soft
46
+ from gradio.themes.utils import colors, fonts, sizes
47
+
48
+ colors.orange_red = colors.Color(
49
+ name="orange_red",
50
+ c50="#FFF0E5",
51
+ c100="#FFE0CC",
52
+ c200="#FFC299",
53
+ c300="#FFA366",
54
+ c400="#FF8533",
55
+ c500="#FF4500",
56
+ c600="#E63E00",
57
+ c700="#CC3700",
58
+ c800="#B33000",
59
+ c900="#992900",
60
+ c950="#802200",
61
+ )
62
+
63
+ class OrangeRedTheme(Soft):
64
+ def __init__(
65
+ self,
66
+ *,
67
+ primary_hue: colors.Color | str = colors.gray,
68
+ secondary_hue: colors.Color | str = colors.orange_red,
69
+ neutral_hue: colors.Color | str = colors.slate,
70
+ text_size: sizes.Size | str = sizes.text_lg,
71
+ font: fonts.Font | str | Iterable[fonts.Font | str] = (
72
+ fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
73
+ ),
74
+ font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
75
+ fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
76
+ ),
77
+ ):
78
+ super().__init__(
79
+ primary_hue=primary_hue,
80
+ secondary_hue=secondary_hue,
81
+ neutral_hue=neutral_hue,
82
+ text_size=text_size,
83
+ font=font,
84
+ font_mono=font_mono,
85
+ )
86
+ super().set(
87
+ background_fill_primary="*primary_50",
88
+ background_fill_primary_dark="*primary_900",
89
+ body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
90
+ body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
91
+ button_primary_text_color="white",
92
+ button_primary_text_color_hover="white",
93
+ button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
94
+ button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
95
+ button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
96
+ button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
97
+ button_secondary_text_color="black",
98
+ button_secondary_text_color_hover="white",
99
+ button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
100
+ button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
101
+ button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
102
+ button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
103
+ slider_color="*secondary_500",
104
+ slider_color_dark="*secondary_600",
105
+ block_title_text_weight="600",
106
+ block_border_width="3px",
107
+ block_shadow="*shadow_drop_lg",
108
+ button_primary_shadow="*shadow_drop_lg",
109
+ button_large_padding="11px",
110
+ color_accent_soft="*primary_100",
111
+ block_label_background_fill="*primary_200",
112
+ )
113
+
114
+ orange_red_theme = OrangeRedTheme()
115
+
116
  high_level_config = {
117
  "path": "configs/train.yaml",
118
  "hf_model_name": "facebook/map-anything-v1",
 
821
 
822
  /* ── Measure note ── */
823
  .measure-note { font-size: 0.78rem !important; opacity: 0.6 !important; margin-top: 6px !important; }
824
+
825
+ #col-container {
826
+ margin: 0 auto;
827
+ max-width: 960px;
828
+ }
829
+ #main-title h1 {font-size: 2.4em !important;}
830
+
831
+
832
  """
833
 
834
  # -------------------------------------------------------------------------
835
  # 6) Build Gradio UI
836
  # -------------------------------------------------------------------------
837
+ with gr.Blocks() as demo:
838
 
839
  # Hidden state
840
  is_example = gr.Textbox(visible=False, value="None")
 
846
  # ── Header ──────────────────────────────────────────────────────────
847
  with gr.Column(elem_id="app-shell"):
848
  with gr.Column(elem_id="app-header"):
849
+ gr.Markdown("# **Map-Anything-v1**", elem_id="main-title")
850
+ gr.Markdown("### Metric 3D Reconstruction (Point Cloud and Camera Poses)")
851
 
852
  # ── Main two-column layout ───────────────────────────────────────
853
  with gr.Row(equal_height=False):
 
1144
  outputs=[measure_image, measure_points_state],
1145
  )
1146
 
1147
+ demo.queue(max_size=20).launch(theme=orange_red_theme, css=CUSTOM_CSS, show_error=True, share=True, ssr_mode=False)