File size: 1,184 Bytes
bcb86b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import gradio as gr
import os
import threading
import time
from agent.cua_agent import ComputerUsingAgent

# Initialize Agent
agent = ComputerUsingAgent()

def execute_task(task_description):
    """Execute a task using the agent"""
    return agent.execute_task(task_description)

def get_status():
    """Get agent status"""
    return {
        "status": agent.task_status,
        "current_task": agent.current_task
    }

# Gradio UI
with gr.Blocks(title="Tiny X11 Agent") as demo:
    gr.Markdown("# 🐜 Tiny X11 Desktop Agent")
    
    with gr.Row():
        # Desktop View
        gr.HTML("""
            <iframe src="/vnc.html?autoconnect=true&resize=scale" 
                    width="100%" height="600" 
                    style="border: 1px solid #ccc;"></iframe>
        """)
        
        # Controls
        with gr.Column():
            task_input = gr.Textbox(label="Task", placeholder="Open Firefox...")
            btn_run = gr.Button("Run")
            output = gr.JSON(label="Output")
            
            btn_run.click(execute_task, inputs=task_input, outputs=output)

if __name__ == "__main__":
    demo.launch(server_name="0.0.0.0", server_port=7860)