import os import gradio as gr from agent import agent # your CodeAgent def run_agent(question: str) -> str: """ A simple shim that takes one input string and returns the agent's final text answer as a plain string. """ # If you want stateless calls, you can reset agent memory here. response = agent(question) return str(response).strip() iface = gr.Interface( fn=run_agent, inputs=gr.Textbox(lines=2, label="Question"), outputs=gr.Textbox(label="Answer"), title="My Agent — Single-Question API", description=( "POST to /run/predict with JSON {\"data\": [\"\"]},\n" "and you’ll get back {\"data\": [\"\"]}." ) ) if __name__ == "__main__": # Gradio will automatically spin up the /run/predict endpoint for this Interface iface.launch(server_name="0.0.0.0", server_port=7860, debug=True, share=False)