| # OpenClaw Agent Gradio Demo | |
| import gradio as gr | |
| def openclaw_command(command): | |
| """Mock OpenClaw command execution (replace with real CLI calls)""" | |
| if "status" in command: | |
| return "β OpenClaw Gateway is running\nπ€ Skills: 12 loaded\nπ‘ Channels: Telegram, Webchat" | |
| elif "restart" in command: | |
| return "π Restarting OpenClaw Gateway... Done!" | |
| else: | |
| return f"π¦ Executing: {command}\nResults will appear here." | |
| # Gradio UI | |
| with gr.Blocks(title="OpenClaw Agent") as demo: | |
| gr.Markdown(""" | |
| # π¦ OpenClaw Agent | |
| *Run AI agents via Telegram or Web* | |
| """) | |
| with gr.Row(): | |
| with gr.Column(): | |
| cmd_input = gr.Textbox( | |
| label="OpenClaw Command", | |
| placeholder="/skills list | /agents spawn | openclaw status" | |
| ) | |
| submit_btn = gr.Button("β‘ Execute") | |
| with gr.Column(): | |
| output = gr.Textbox(label="Output", lines=10) | |
| submit_btn.click( | |
| fn=openclaw_command, | |
| inputs=cmd_input, | |
| outputs=output | |
| ) | |
| gr.Markdown(""" | |
| ### Examples | |
| - `openclaw status` | |
| - `/huggingface models ls --author Jacky2305` | |
| - `/weather get --location Singapore` | |
| """) | |
| if __name__ == "__main__": | |
| demo.launch(server_name="0.0.0.0", server_port=7860)# Force re-upload Fri May 1 01:09:21 UTC 2026 | |