Spaces:
Paused
Paused
change model choose to start position input
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ MODEL_CHOICES = [
|
|
| 41 |
def submit_to_backend(
|
| 42 |
scene: str,
|
| 43 |
prompt: str,
|
| 44 |
-
|
| 45 |
max_steps: int = 100,
|
| 46 |
visualize: bool = True
|
| 47 |
) -> dict:
|
|
@@ -51,7 +51,7 @@ def submit_to_backend(
|
|
| 51 |
payload = {
|
| 52 |
"scene_config": scene,
|
| 53 |
"prompt": prompt,
|
| 54 |
-
"
|
| 55 |
"params": {
|
| 56 |
"max_steps": max_steps,
|
| 57 |
"visualize": visualize
|
|
@@ -60,6 +60,7 @@ def submit_to_backend(
|
|
| 60 |
"submit_from": "gradio_ui"
|
| 61 |
}
|
| 62 |
}
|
|
|
|
| 63 |
|
| 64 |
try:
|
| 65 |
response = requests.post(
|
|
@@ -191,12 +192,13 @@ with gr.Blocks(title="机器人导航仿真系统", css=custom_css) as demo:
|
|
| 191 |
max_lines=4
|
| 192 |
)
|
| 193 |
|
| 194 |
-
#
|
| 195 |
-
|
| 196 |
-
label="
|
| 197 |
-
|
| 198 |
-
|
| 199 |
)
|
|
|
|
| 200 |
|
| 201 |
# 高级参数
|
| 202 |
with gr.Accordion("高级设置", open=False):
|
|
@@ -243,18 +245,19 @@ with gr.Blocks(title="机器人导航仿真系统", css=custom_css) as demo:
|
|
| 243 |
# 示例任务
|
| 244 |
gr.Examples(
|
| 245 |
examples=[
|
| 246 |
-
["default_desk", "
|
| 247 |
-
["cluttered_desk", "
|
| 248 |
-
["industrial_table", "
|
| 249 |
],
|
| 250 |
-
inputs=[scene_dropdown, prompt_input,
|
| 251 |
label="导航任务示例"
|
| 252 |
)
|
| 253 |
|
|
|
|
| 254 |
# 提交处理逻辑
|
| 255 |
submit_btn.click(
|
| 256 |
fn=run_simulation,
|
| 257 |
-
inputs=[scene_dropdown, prompt_input,
|
| 258 |
outputs=[video_output, metrics_output, log_output],
|
| 259 |
api_name="run_simulation"
|
| 260 |
)
|
|
|
|
| 41 |
def submit_to_backend(
|
| 42 |
scene: str,
|
| 43 |
prompt: str,
|
| 44 |
+
start_position: str,
|
| 45 |
max_steps: int = 100,
|
| 46 |
visualize: bool = True
|
| 47 |
) -> dict:
|
|
|
|
| 51 |
payload = {
|
| 52 |
"scene_config": scene,
|
| 53 |
"prompt": prompt,
|
| 54 |
+
"start_position": start_position,
|
| 55 |
"params": {
|
| 56 |
"max_steps": max_steps,
|
| 57 |
"visualize": visualize
|
|
|
|
| 60 |
"submit_from": "gradio_ui"
|
| 61 |
}
|
| 62 |
}
|
| 63 |
+
|
| 64 |
|
| 65 |
try:
|
| 66 |
response = requests.post(
|
|
|
|
| 192 |
max_lines=4
|
| 193 |
)
|
| 194 |
|
| 195 |
+
# 起始坐标输入
|
| 196 |
+
start_pos_input = gr.Textbox(
|
| 197 |
+
label="起始位置坐标 (x, y, z)",
|
| 198 |
+
placeholder="例如:0.0, 0.0, 0.2",
|
| 199 |
+
lines=1
|
| 200 |
)
|
| 201 |
+
|
| 202 |
|
| 203 |
# 高级参数
|
| 204 |
with gr.Accordion("高级设置", open=False):
|
|
|
|
| 245 |
# 示例任务
|
| 246 |
gr.Examples(
|
| 247 |
examples=[
|
| 248 |
+
["default_desk", "从桌角出发,前往番茄酱附近", "0.0, 0.0, 0.1"],
|
| 249 |
+
["cluttered_desk", "从水杯出发,移动到手机旁", "1.0, -0.5, 0.0"],
|
| 250 |
+
["industrial_table", "避开扳手,从台边移动到润滑剂", "0.5, 0.2, 0.0"]
|
| 251 |
],
|
| 252 |
+
inputs=[scene_dropdown, prompt_input, start_pos_input],
|
| 253 |
label="导航任务示例"
|
| 254 |
)
|
| 255 |
|
| 256 |
+
|
| 257 |
# 提交处理逻辑
|
| 258 |
submit_btn.click(
|
| 259 |
fn=run_simulation,
|
| 260 |
+
inputs=[scene_dropdown, prompt_input, start_pos_input],
|
| 261 |
outputs=[video_output, metrics_output, log_output],
|
| 262 |
api_name="run_simulation"
|
| 263 |
)
|