Update app.py
Browse files
app.py
CHANGED
|
@@ -34,23 +34,22 @@ class SecondLifeNavigator:
|
|
| 34 |
action_sequence = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 35 |
return action_sequence
|
| 36 |
|
| 37 |
-
# Simplify run method for Gradio compatibility
|
| 38 |
def run(self, current_state, corrade_endpoint):
|
| 39 |
action_sequence = self.generate_action_sequence(current_state)
|
| 40 |
# Removed automatic command execution for safety and demonstration purposes
|
| 41 |
return action_sequence
|
| 42 |
|
| 43 |
def create_interface():
|
| 44 |
-
def navigate(current_state
|
|
|
|
| 45 |
sl_navigator = SecondLifeNavigator()
|
| 46 |
-
action_sequence = sl_navigator.run(current_state,
|
| 47 |
return action_sequence
|
| 48 |
|
| 49 |
interface = gr.Interface(
|
| 50 |
fn=navigate,
|
| 51 |
-
inputs=
|
| 52 |
-
|
| 53 |
-
outputs=[gr.Textbox(label="Generated Action Sequence")],
|
| 54 |
title="Second Life Navigator",
|
| 55 |
description="Generates an action sequence based on the current state for navigating in Second Life.",
|
| 56 |
)
|
|
|
|
| 34 |
action_sequence = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 35 |
return action_sequence
|
| 36 |
|
|
|
|
| 37 |
def run(self, current_state, corrade_endpoint):
|
| 38 |
action_sequence = self.generate_action_sequence(current_state)
|
| 39 |
# Removed automatic command execution for safety and demonstration purposes
|
| 40 |
return action_sequence
|
| 41 |
|
| 42 |
def create_interface():
|
| 43 |
+
def navigate(current_state):
|
| 44 |
+
endpoint = os.environ.get('url') # Ensure this environment variable is correctly set.
|
| 45 |
sl_navigator = SecondLifeNavigator()
|
| 46 |
+
action_sequence = sl_navigator.run(current_state, endpoint) # Pass the endpoint to the run method.
|
| 47 |
return action_sequence
|
| 48 |
|
| 49 |
interface = gr.Interface(
|
| 50 |
fn=navigate,
|
| 51 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter current state..."), # Corrected syntax here
|
| 52 |
+
outputs=gr.Textbox(label="Generated Action Sequence"),
|
|
|
|
| 53 |
title="Second Life Navigator",
|
| 54 |
description="Generates an action sequence based on the current state for navigating in Second Life.",
|
| 55 |
)
|