File size: 1,818 Bytes
ac02138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import os

def get_status():
    cuda = "Unknown"
    try:
        import torch
        cuda = "Available: " + torch.cuda.get_device_name(0) if torch.cuda.is_available() else "Not available"
    except:
        pass
    status = "## Environment Status\n"
    status += "- ANTHROPIC_API_KEY: " + ("Set" if os.environ.get("ANTHROPIC_API_KEY") else "Not set") + "\n"
    status += "- HF_TOKEN: " + ("Set" if os.environ.get("HF_TOKEN") else "Not set") + "\n"
    status += "- CUDA: " + cuda + "\n\n"
    status += "## Training Status\nStatus: Ready to start\n\nConfigure secrets in Space settings, then click Start Training."
    return status

def start_training(model, samples, epochs, lr, hub_id):
    return "Training started with " + model + ", " + str(samples) + " samples, " + str(epochs) + " epochs. Check logs for progress."

with gr.Blocks(title="Agent Zero Terminals SDK Trainer") as demo:
    gr.Markdown("# Agent Zero Terminals SDK Trainer")
    gr.Markdown("Training for terminals.tech SDK patterns")
    with gr.Row():
        with gr.Column():
            model = gr.Dropdown(["Qwen/Qwen2.5-Coder-14B-Instruct"], value="Qwen/Qwen2.5-Coder-14B-Instruct", label="Model")
            samples = gr.Slider(100, 50000, 10000, label="Samples")
            epochs = gr.Slider(1, 10, 3, label="Epochs")
            lr = gr.Number(2e-5, label="Learning Rate")
            hub_id = gr.Textbox("wheattoast11/agent-zero-terminals-sdk", label="Hub ID")
            btn = gr.Button("Start Training", variant="primary")
        with gr.Column():
            status = gr.Markdown(get_status())
    btn.click(start_training, [model, samples, epochs, lr, hub_id], status)
    gr.Markdown("**Intuition Labs** | L40S ~$1.80/hr - PAUSE after training!")

demo.launch(server_name="0.0.0.0", server_port=7860)