Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,25 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from agent import TakeoffAgent
|
| 3 |
-
|
| 4 |
-
# Initialize the agent
|
| 5 |
-
agent = TakeoffAgent()
|
| 6 |
-
|
| 7 |
-
def chat_response(message, history):
|
| 8 |
-
# The agent handles state, parsing, and calculation logic
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
gr.Markdown("
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from agent import TakeoffAgent
|
| 3 |
+
|
| 4 |
+
# Initialize the agent
|
| 5 |
+
agent = TakeoffAgent()
|
| 6 |
+
|
| 7 |
+
def chat_response(message, history):
|
| 8 |
+
# The agent handles state, parsing, and calculation logic
|
| 9 |
+
# We don't use 'history' in the logic, so the format (tuples vs dicts) doesn't matter
|
| 10 |
+
response = agent.process_message(message)
|
| 11 |
+
return response
|
| 12 |
+
|
| 13 |
+
# Clean Chat Interface
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
gr.Markdown("# ✈️ PA-28-181 AI Performance Engineer")
|
| 16 |
+
gr.Markdown("Describe your conditions naturally. Example: *'I am at 2000ft, 25C, QNH 1013, 1090kg with 10kt headwind'*")
|
| 17 |
+
|
| 18 |
+
# Removed 'type="messages"' to fix the TypeError
|
| 19 |
+
chat_interface = gr.ChatInterface(
|
| 20 |
+
fn=chat_response,
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
if __name__ == "__main__":
|
| 24 |
+
# Moved theme to launch() to address the Gradio UserWarning
|
| 25 |
+
demo.launch(theme=gr.themes.Soft())
|