Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -110,7 +110,7 @@ with gr.Blocks(css=css, theme=gr.themes.Base()) as demo:
|
|
110 |
[`Website`](https://4m.epfl.ch) | [`GitHub`](https://github.com/apple/ml-4m) <br>[`4M Paper (NeurIPS'23)`](https://arxiv.org/abs/2312.06647) | [`4M-21 Paper (arXiv'24)`](https://arxiv.org/abs/2406.09406)
|
111 |
|
112 |
This demo predicts all modalities from a given RGB input, using [{FM_MODEL_ID}](https://huggingface.co/{FM_MODEL_ID}), running on *{power_device}*.
|
113 |
-
For more generative examples,
|
114 |
""")
|
115 |
|
116 |
img_path = gr.Image(label='RGB input image', type='filepath')
|
@@ -122,7 +122,7 @@ with gr.Blocks(css=css, theme=gr.themes.Base()) as demo:
|
|
122 |
('CLIP-B/16', 'tok_clip@224'), ('DINOv2-B/14', 'tok_dinov2@224'), ('ImageBind-H/14', 'tok_imagebind@224'),
|
123 |
('Depth', 'tok_depth@224'), ('Surface normals', 'tok_normal@224'), ('Semantic segmentation', 'tok_semseg@224'),
|
124 |
('Canny edges', 'tok_canny_edge@224'), ('SAM edges', 'tok_sam_edge@224'), ('Caption', 'caption'),
|
125 |
-
('Bounding boxes', 'det'), ('SAM instances', 'sam_instance'), ('Color palette', 'color_palette'),
|
126 |
('Metadata', 'metadata'),
|
127 |
],
|
128 |
value=[
|
@@ -134,6 +134,21 @@ with gr.Blocks(css=css, theme=gr.themes.Base()) as demo:
|
|
134 |
label="Target modalities",
|
135 |
info='Choose which modalities are predicted (in this order).'
|
136 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
138 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
|
139 |
top_p = gr.Slider(label="Top-p", minimum=0.0, maximum=1.0, step=0.01, value=0.8)
|
|
|
110 |
[`Website`](https://4m.epfl.ch) | [`GitHub`](https://github.com/apple/ml-4m) <br>[`4M Paper (NeurIPS'23)`](https://arxiv.org/abs/2312.06647) | [`4M-21 Paper (arXiv'24)`](https://arxiv.org/abs/2406.09406)
|
111 |
|
112 |
This demo predicts all modalities from a given RGB input, using [{FM_MODEL_ID}](https://huggingface.co/{FM_MODEL_ID}), running on *{power_device}*.
|
113 |
+
For more generative examples, please see our [GitHub repo](https://github.com/apple/ml-4m).
|
114 |
""")
|
115 |
|
116 |
img_path = gr.Image(label='RGB input image', type='filepath')
|
|
|
122 |
('CLIP-B/16', 'tok_clip@224'), ('DINOv2-B/14', 'tok_dinov2@224'), ('ImageBind-H/14', 'tok_imagebind@224'),
|
123 |
('Depth', 'tok_depth@224'), ('Surface normals', 'tok_normal@224'), ('Semantic segmentation', 'tok_semseg@224'),
|
124 |
('Canny edges', 'tok_canny_edge@224'), ('SAM edges', 'tok_sam_edge@224'), ('Caption', 'caption'),
|
125 |
+
('Bounding boxes', 'det'), ('SAM instances (single pass*)', 'sam_instance'), ('Color palette', 'color_palette'),
|
126 |
('Metadata', 'metadata'),
|
127 |
],
|
128 |
value=[
|
|
|
134 |
label="Target modalities",
|
135 |
info='Choose which modalities are predicted (in this order).'
|
136 |
)
|
137 |
+
gr.Markdown(f"""
|
138 |
+
**Information on modalities**:
|
139 |
+
|
140 |
+
\* *SAM instances* in this demo are generated in a single pass and may look sparse. For sampling dense SAM instances, please see the convenience function
|
141 |
+
[`generate_sam_dense`](https://github.com/apple/ml-4m/blob/e11539965e45aa6731143d742c4493c46b4ef620/fourm/models/generate.py#L1230-L1273)
|
142 |
+
in `fourm.models.generate.GenerationSampler`, and our [4M-21 interactive notebook](https://github.com/apple/ml-4m/blob/main/notebooks/generation_4M-21.ipynb) for usage examples.
|
143 |
+
|
144 |
+
\*\* While 4M-21 models are capable of predicting *4D human poses*, visualizing them requires the SMPL model which cannot be distributed.
|
145 |
+
To visualize poses, please follow these steps:
|
146 |
+
|
147 |
+
1) Install via `pip install timm yacs smplx pyrender pyopengl==3.1.4`
|
148 |
+
You may need to follow the pyrender install instructions: https://pyrender.readthedocs.io/en/latest/install/index.html
|
149 |
+
2) Download SMPL data from https://smpl.is.tue.mpg.de/. See https://github.com/shubham-goel/4D-Humans/ for an example.
|
150 |
+
3) Copy the required SMPL files (`smpl_mean_params.npz`, `SMPL_to_J19.pkl`, `smpl/SMPL_NEUTRAL.pkl`) to `fourm/utils/hmr2_utils/data` .
|
151 |
+
""")
|
152 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
153 |
randomize_seed = gr.Checkbox(label="Randomize seed", value=False)
|
154 |
top_p = gr.Slider(label="Top-p", minimum=0.0, maximum=1.0, step=0.01, value=0.8)
|