Spaces:
Running
Running
init
Browse files- app.py +3 -7
- app_config.py +10 -4
app.py
CHANGED
@@ -6,7 +6,7 @@ import torch
|
|
6 |
import numpy as np
|
7 |
from matplotlib.colors import LinearSegmentedColormap
|
8 |
|
9 |
-
from app_config import CSS,
|
10 |
import sample_cond
|
11 |
|
12 |
model = sample_cond.load_model()
|
@@ -30,7 +30,6 @@ def colorize_depth(depth, log_scale):
|
|
30 |
return rgb
|
31 |
|
32 |
|
33 |
-
@spaces.GPU
|
34 |
@torch.no_grad()
|
35 |
def generate_lidar(model, cond):
|
36 |
img, pcd = sample_cond.sample(model, cond)
|
@@ -47,10 +46,7 @@ def load_camera(image):
|
|
47 |
|
48 |
|
49 |
with gr.Blocks(css=CSS) as demo:
|
50 |
-
gr.Markdown(
|
51 |
-
gr.Markdown(DESCRIPTION)
|
52 |
-
gr.Markdown("### Camera-to-LiDAR Demo")
|
53 |
-
# gr.Markdown("You can slide the output to compare the depth prediction with input image")
|
54 |
|
55 |
with gr.Row():
|
56 |
input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
|
@@ -76,7 +72,7 @@ with gr.Blocks(css=CSS) as demo:
|
|
76 |
examples = gr.Examples(examples=example_files, inputs=[input_image], outputs=[output_image, raw_file],
|
77 |
fn=on_submit, cache_examples=True)
|
78 |
|
79 |
-
gr.Markdown(
|
80 |
|
81 |
|
82 |
if __name__ == '__main__':
|
|
|
6 |
import numpy as np
|
7 |
from matplotlib.colors import LinearSegmentedColormap
|
8 |
|
9 |
+
from app_config import CSS, HEADER, FOOTER, DEVICE
|
10 |
import sample_cond
|
11 |
|
12 |
model = sample_cond.load_model()
|
|
|
30 |
return rgb
|
31 |
|
32 |
|
|
|
33 |
@torch.no_grad()
|
34 |
def generate_lidar(model, cond):
|
35 |
img, pcd = sample_cond.sample(model, cond)
|
|
|
46 |
|
47 |
|
48 |
with gr.Blocks(css=CSS) as demo:
|
49 |
+
gr.Markdown(HEADER)
|
|
|
|
|
|
|
50 |
|
51 |
with gr.Row():
|
52 |
input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
|
|
|
72 |
examples = gr.Examples(examples=example_files, inputs=[input_image], outputs=[output_image, raw_file],
|
73 |
fn=on_submit, cache_examples=True)
|
74 |
|
75 |
+
gr.Markdown(FOOTER)
|
76 |
|
77 |
|
78 |
if __name__ == '__main__':
|
app_config.py
CHANGED
@@ -12,10 +12,16 @@ CSS = """
|
|
12 |
}
|
13 |
"""
|
14 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
```bibtex
|
20 |
@inproceedings{ran2024towards,
|
21 |
title={Towards Realistic Scene Generation with LiDAR Diffusion Models},
|
|
|
12 |
}
|
13 |
"""
|
14 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
15 |
+
|
16 |
+
HEADER = '''
|
17 |
+
# LiDAR Diffusion
|
18 |
+
Official demo for **LiDAR Diffusion: Towards Realistic Scene Generation with LiDAR Diffusion Models**.
|
19 |
+
Please refer to our [paper](https://arxiv.org/abs/2404.00815), [project page](https://lidar-diffusion.github.io/), or [github](https://github.com/hancyran/LiDAR-Diffusion) for more details.
|
20 |
+
|
21 |
+
### Camera-to-LiDAR Demo
|
22 |
+
'''
|
23 |
+
|
24 |
+
FOOTER = r"""
|
25 |
```bibtex
|
26 |
@inproceedings{ran2024towards,
|
27 |
title={Towards Realistic Scene Generation with LiDAR Diffusion Models},
|