SceneDiffuser commited on
Commit
4e60da3
1 Parent(s): 056ce25

Upload 2 files

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. app.py +79 -0
  3. figures/teaser.png +3 -0
.gitattributes CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ figures/teaser.png filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import random
4
+ import pickle
5
+ import numpy as np
6
+ from PIL import Image
7
+ from huggingface_hub import hf_hub_download
8
+
9
+ def pose_generation(scene, count):
10
+ assert isinstance(scene, str)
11
+ results_path = hf_hub_download('SceneDiffuser/SceneDiffuser', 'results/pose_generation/results.pkl')
12
+ with open(results_path, 'rb') as f:
13
+ results = pickle.load(f)
14
+
15
+ images = [Image.fromarray(results[scene][random.randint(0, 19)]) for i in range(count)]
16
+ return images
17
+
18
+ def path_planning(case_id):
19
+ assert isinstance(case_id, str)
20
+ results_path = hf_hub_download('SceneDiffuser/SceneDiffuser', 'results/path_planning/results.pkl')
21
+ with open(results_path, 'rb') as f:
22
+ results = pickle.load(f)
23
+
24
+ case = results[case_id]
25
+ steps = case['step']
26
+ image = Image.fromarray(case['image'])
27
+ return image, steps
28
+
29
+ with gr.Blocks() as demo:
30
+ gr.Markdown("# **<p align='center'>Diffusion-based Generation, Optimization, and Planning in 3D Scenes</p>**")
31
+ gr.HTML(value="<img src='file/figures/teaser.png' alt='Teaser' width='710px' height='284px' style='display: block; margin: auto;'>")
32
+ gr.HTML(value="<p align='center' style='font-size: 1.25em; color: #485fc7;'><a href='' target='_blank'>Paper</a> | <a href='' target='_blank'>Project Page</a> | <a href='' target='_blank'>Github</a></p>")
33
+ gr.Markdown("<p align='center'><i>\"SceneDiffuser provides a unified model for solving scene-conditioned generation, optimization, and planning.\"</i></p>")
34
+
35
+ ## five task
36
+ ## pose generation
37
+ with gr.Tab("Pose Generation"):
38
+ with gr.Row():
39
+ with gr.Column():
40
+ input1 = [
41
+ gr.Dropdown(choices=['MPH16', 'MPH1Library', 'N0SittingBooth', 'N3OpenArea'], label='Scenes'),
42
+ gr.Slider(minimum=1, maximum=4, step=1, label='Count', interactive=True)
43
+ ]
44
+ button1 = gr.Button("Generate")
45
+ with gr.Column():
46
+ output1 = [
47
+ gr.Gallery(label="Result").style(grid=[1], height="auto")
48
+ ]
49
+ button1.click(pose_generation, inputs=input1, outputs=output1)
50
+
51
+ ## motion generation
52
+ with gr.Tab("Motion Generation"):
53
+ gr.Markdown('Coming soon!')
54
+
55
+ ## grasp generation
56
+ with gr.Tab("Grasp Generation"):
57
+ gr.Markdown('Coming soon!')
58
+
59
+ ## path planning
60
+ with gr.Tab("Path Planing"):
61
+ with gr.Row():
62
+ with gr.Column():
63
+ input4 = [
64
+ gr.Dropdown(choices=['scene0603_00_N0pT', 'scene0621_00_cJ4H', 'scene0634_00_48Y3', 'scene0634_00_gIRH', 'scene0637_00_YgjR', 'scene0640_00_BO94', 'scene0641_00_3K6J', 'scene0641_00_KBKx', 'scene0641_00_cb7l', 'scene0645_00_35Hy', 'scene0645_00_47D1', 'scene0645_00_XfLE', 'scene0667_00_DK4F', 'scene0667_00_o7XB', 'scene0667_00_rUMp', 'scene0672_00_U250', 'scene0673_00_Jyw8', 'scene0673_00_u1lJ', 'scene0678_00_QbNL', 'scene0678_00_RrY0', 'scene0678_00_aE1p', 'scene0678_00_hnXu', 'scene0694_00_DgAL', 'scene0694_00_etF5', 'scene0698_00_tT3Q'], label='Scenes'),
65
+ ]
66
+ button4 = gr.Button("Run")
67
+ with gr.Column():
68
+ # output4 = gr.Gallery(label="Result").style(grid=[1], height="auto")
69
+ output4 = [
70
+ gr.Image(label="Result"),
71
+ gr.Number(label="Steps", precision=0)
72
+ ]
73
+ button4.click(path_planning, inputs=input4, outputs=output4)
74
+
75
+ ## arm motion planning
76
+ with gr.Tab("Arm Motion Planning"):
77
+ gr.Markdown('Coming soon!')
78
+
79
+ demo.launch()
figures/teaser.png ADDED

Git LFS Details

  • SHA256: f8f229934fb83f08783517abd42c3f94c0710695f3f79762824a0e5db4f3741f
  • Pointer size: 132 Bytes
  • Size of remote file: 1.63 MB