Spaces:
Runtime error
Runtime error
zfzhang-thu
commited on
Commit
•
0cfc205
1
Parent(s):
782b3bb
Follow ZeroGPT usage guidance to decorate GPU-required functions
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
import re
|
|
|
4 |
|
5 |
from leo.inference import inference
|
6 |
|
@@ -46,6 +47,7 @@ with gr.Blocks(title='LEO Demo') as demo:
|
|
46 |
)
|
47 |
|
48 |
# LEO task-to-plan inference wrapper
|
|
|
49 |
def leo_task_to_plan(task_description):
|
50 |
task_input = {
|
51 |
"task_description": task_description,
|
@@ -58,6 +60,7 @@ with gr.Blocks(title='LEO Demo') as demo:
|
|
58 |
return plan
|
59 |
|
60 |
# LEO ground inference wrapper
|
|
|
61 |
def leo_plan_to_masks(task_description, *action_steps):
|
62 |
formatted_action_steps = [
|
63 |
{"action": step, "target_id": "unknown", "label": "unknown"} for step in action_steps if step != ""
|
@@ -72,6 +75,7 @@ with gr.Blocks(title='LEO Demo') as demo:
|
|
72 |
return [f"assets/mask/scene0050_00/scene0050_00_obj_{mask}.glb" for mask in masks] + ["assets/mask/scene0050_00/scene0050_00_obj_empty.glb"] * (STEP_COUNTS - len(masks))
|
73 |
|
74 |
# LEO task-to-plan and ground inference wrapper
|
|
|
75 |
def leo_task_to_plan_and_masks(task_description):
|
76 |
task_input = {
|
77 |
"task_description": task_description,
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
import re
|
4 |
+
import spaces
|
5 |
|
6 |
from leo.inference import inference
|
7 |
|
|
|
47 |
)
|
48 |
|
49 |
# LEO task-to-plan inference wrapper
|
50 |
+
@spaces.GPU
|
51 |
def leo_task_to_plan(task_description):
|
52 |
task_input = {
|
53 |
"task_description": task_description,
|
|
|
60 |
return plan
|
61 |
|
62 |
# LEO ground inference wrapper
|
63 |
+
@spaces.GPU
|
64 |
def leo_plan_to_masks(task_description, *action_steps):
|
65 |
formatted_action_steps = [
|
66 |
{"action": step, "target_id": "unknown", "label": "unknown"} for step in action_steps if step != ""
|
|
|
75 |
return [f"assets/mask/scene0050_00/scene0050_00_obj_{mask}.glb" for mask in masks] + ["assets/mask/scene0050_00/scene0050_00_obj_empty.glb"] * (STEP_COUNTS - len(masks))
|
76 |
|
77 |
# LEO task-to-plan and ground inference wrapper
|
78 |
+
@spaces.GPU
|
79 |
def leo_task_to_plan_and_masks(task_description):
|
80 |
task_input = {
|
81 |
"task_description": task_description,
|