Spaces:
Sleeping
Sleeping
SceneDiffuser
commited on
Commit
•
7150512
1
Parent(s):
e9722ce
Update app.py
Browse files
app.py
CHANGED
@@ -38,6 +38,24 @@ def pose_generation_mesh(scene, count):
|
|
38 |
|
39 |
return res
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
def grasp_generation(case_id):
|
42 |
assert isinstance(case_id, str)
|
43 |
res = f"./results/grasp_generation/results/{case_id}/{random.randint(0, 19)}.glb"
|
@@ -93,7 +111,15 @@ with gr.Blocks() as demo:
|
|
93 |
|
94 |
## motion generation
|
95 |
with gr.Tab("Motion Generation"):
|
96 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
## grasp generation
|
99 |
with gr.Tab("Grasp Generation"):
|
|
|
38 |
|
39 |
return res
|
40 |
|
41 |
+
def motion_generation(scene):
|
42 |
+
assert isinstance(scene, str)
|
43 |
+
cnt = {
|
44 |
+
'MPH1Library': 3,
|
45 |
+
'MPH16': 6,
|
46 |
+
'N0SittingBooth': 7,
|
47 |
+
'N3OpenArea': 5
|
48 |
+
}[scene]
|
49 |
+
|
50 |
+
res = f"./results/motion_generation/results/{scene}/{random.randint(0, cnt-1)}.gif"
|
51 |
+
if not os.path.exists(res):
|
52 |
+
results_path = hf_hub_download('SceneDiffuser/SceneDiffuser', 'results/motion_generation/results.zip')
|
53 |
+
os.makedirs('./results/motion_generation/', exist_ok=True)
|
54 |
+
with zipfile.ZipFile(results_path, 'r') as zip_ref:
|
55 |
+
zip_ref.extractall('./results/motion_generation/')
|
56 |
+
|
57 |
+
return res
|
58 |
+
|
59 |
def grasp_generation(case_id):
|
60 |
assert isinstance(case_id, str)
|
61 |
res = f"./results/grasp_generation/results/{case_id}/{random.randint(0, 19)}.glb"
|
|
|
111 |
|
112 |
## motion generation
|
113 |
with gr.Tab("Motion Generation"):
|
114 |
+
with gr.Row():
|
115 |
+
with gr.Column():
|
116 |
+
input2 = [
|
117 |
+
gr.Dropdown(choices=['MPH16', 'MPH1Library', 'N0SittingBooth', 'N3OpenArea'], label='Scenes')
|
118 |
+
]
|
119 |
+
button2 = gr.Button("Generate")
|
120 |
+
with gr.Column():
|
121 |
+
output2 = gr.Image(label="Result")
|
122 |
+
button2.click(motion_generation, inputs=input2, outputs=output2)
|
123 |
|
124 |
## grasp generation
|
125 |
with gr.Tab("Grasp Generation"):
|