Spaces:
Build error
Build error
Commit
·
c1e3f7e
1
Parent(s):
d250443
more
Browse files
app.py
CHANGED
|
@@ -103,7 +103,7 @@ def create_animation(path):
|
|
| 103 |
|
| 104 |
def move_agent(target_input: int):
|
| 105 |
if target_input not in goal_dict:
|
| 106 |
-
return create_standing_animation(), '
|
| 107 |
# get goal locations:
|
| 108 |
goal_x, goal_y = goal_dict[target_input]
|
| 109 |
# build the path
|
|
@@ -164,12 +164,12 @@ def get_target_from_request(request_text):
|
|
| 164 |
return 3
|
| 165 |
if any(item in request_text for item in ['FOUR', 'FOURTH']):
|
| 166 |
return 4
|
| 167 |
-
return '
|
| 168 |
|
| 169 |
|
| 170 |
def create_demo():
|
| 171 |
# main blocks
|
| 172 |
-
with gr.Blocks() as
|
| 173 |
gr.Markdown("# Agent Control with Language")
|
| 174 |
gr.Markdown('Say the agent where to go and what to do')
|
| 175 |
|
|
@@ -179,7 +179,7 @@ def create_demo():
|
|
| 179 |
# send_btn = gr.Button(value='Send Request')
|
| 180 |
request_text = gr.Textbox(label="Request:", lines=2, interactive=False)
|
| 181 |
request_target = gr.Textbox(label='Target:', lines=2)
|
| 182 |
-
status = gr.Textbox(label='
|
| 183 |
with gr.Column():
|
| 184 |
output_env = gr.Video(label="Env:", autoplay=True)
|
| 185 |
with gr.Accordion("TODO List", open=False):
|
|
@@ -193,14 +193,14 @@ def create_demo():
|
|
| 193 |
|
| 194 |
# EVENTS:
|
| 195 |
# gr.on(triggers=["load"], fn=load_image_on_start, outputs=output_env_image)
|
| 196 |
-
#
|
| 197 |
-
|
| 198 |
# request_audio.stream(fn=get_text_request, inputs=request_audio, outputs=request_text)
|
| 199 |
request_audio.stop_recording(fn=get_text_request, inputs=request_audio, outputs=request_text)
|
| 200 |
request_text.change(fn=get_target_from_request, inputs=request_text, outputs=request_target)
|
| 201 |
request_target.change(fn=move_agent, inputs=request_target, outputs=[output_env, status])
|
| 202 |
request_audio.stop_recording(lambda: None, outputs=request_audio)
|
| 203 |
-
return
|
| 204 |
|
| 205 |
# ---------------------------- #
|
| 206 |
# main
|
|
|
|
| 103 |
|
| 104 |
def move_agent(target_input: int):
|
| 105 |
if target_input not in goal_dict:
|
| 106 |
+
return create_standing_animation(), 'Say it again.. To what goal you want me to go?..'
|
| 107 |
# get goal locations:
|
| 108 |
goal_x, goal_y = goal_dict[target_input]
|
| 109 |
# build the path
|
|
|
|
| 164 |
return 3
|
| 165 |
if any(item in request_text for item in ['FOUR', 'FOURTH']):
|
| 166 |
return 4
|
| 167 |
+
return 'No goal found.'
|
| 168 |
|
| 169 |
|
| 170 |
def create_demo():
|
| 171 |
# main blocks
|
| 172 |
+
with gr.Blocks() as my_demo:
|
| 173 |
gr.Markdown("# Agent Control with Language")
|
| 174 |
gr.Markdown('Say the agent where to go and what to do')
|
| 175 |
|
|
|
|
| 179 |
# send_btn = gr.Button(value='Send Request')
|
| 180 |
request_text = gr.Textbox(label="Request:", lines=2, interactive=False)
|
| 181 |
request_target = gr.Textbox(label='Target:', lines=2)
|
| 182 |
+
status = gr.Textbox(label='Status:', lines=2)
|
| 183 |
with gr.Column():
|
| 184 |
output_env = gr.Video(label="Env:", autoplay=True)
|
| 185 |
with gr.Accordion("TODO List", open=False):
|
|
|
|
| 193 |
|
| 194 |
# EVENTS:
|
| 195 |
# gr.on(triggers=["load"], fn=load_image_on_start, outputs=output_env_image)
|
| 196 |
+
# my_demo.load(fn=load_image_on_start, outputs=output_env_image)
|
| 197 |
+
my_demo.load(fn=create_standing_animation, outputs=output_env)
|
| 198 |
# request_audio.stream(fn=get_text_request, inputs=request_audio, outputs=request_text)
|
| 199 |
request_audio.stop_recording(fn=get_text_request, inputs=request_audio, outputs=request_text)
|
| 200 |
request_text.change(fn=get_target_from_request, inputs=request_text, outputs=request_target)
|
| 201 |
request_target.change(fn=move_agent, inputs=request_target, outputs=[output_env, status])
|
| 202 |
request_audio.stop_recording(lambda: None, outputs=request_audio)
|
| 203 |
+
return my_demo
|
| 204 |
|
| 205 |
# ---------------------------- #
|
| 206 |
# main
|