File size: 851 Bytes
f596100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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())