Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from agent import TakeoffAgent | |
| # Initialize the agent | |
| agent = TakeoffAgent() | |
| def chat_response(message, history): | |
| # The agent handles state, parsing, and calculation logic | |
| # We don't use 'history' in the logic, so the format (tuples vs dicts) doesn't matter | |
| response = agent.process_message(message) | |
| return response | |
| # Clean Chat Interface | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# ✈️ PA-28-181 AI Performance Engineer") | |
| gr.Markdown("Describe your conditions naturally. Example: *'I am at 2000ft, 25C, QNH 1013, 1090kg with 10kt headwind'*") | |
| # Removed 'type="messages"' to fix the TypeError | |
| chat_interface = gr.ChatInterface( | |
| fn=chat_response, | |
| ) | |
| if __name__ == "__main__": | |
| # Moved theme to launch() to address the Gradio UserWarning | |
| demo.launch(theme=gr.themes.Soft()) |