Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
def get_status():
|
| 5 |
+
cuda = "Unknown"
|
| 6 |
+
try:
|
| 7 |
+
import torch
|
| 8 |
+
cuda = "Available: " + torch.cuda.get_device_name(0) if torch.cuda.is_available() else "Not available"
|
| 9 |
+
except:
|
| 10 |
+
pass
|
| 11 |
+
status = "## Environment Status\n"
|
| 12 |
+
status += "- ANTHROPIC_API_KEY: " + ("Set" if os.environ.get("ANTHROPIC_API_KEY") else "Not set") + "\n"
|
| 13 |
+
status += "- HF_TOKEN: " + ("Set" if os.environ.get("HF_TOKEN") else "Not set") + "\n"
|
| 14 |
+
status += "- CUDA: " + cuda + "\n\n"
|
| 15 |
+
status += "## Training Status\nStatus: Ready to start\n\nConfigure secrets in Space settings, then click Start Training."
|
| 16 |
+
return status
|
| 17 |
+
|
| 18 |
+
def start_training(model, samples, epochs, lr, hub_id):
|
| 19 |
+
return "Training started with " + model + ", " + str(samples) + " samples, " + str(epochs) + " epochs. Check logs for progress."
|
| 20 |
+
|
| 21 |
+
with gr.Blocks(title="Agent Zero Terminals SDK Trainer") as demo:
|
| 22 |
+
gr.Markdown("# Agent Zero Terminals SDK Trainer")
|
| 23 |
+
gr.Markdown("Training for terminals.tech SDK patterns")
|
| 24 |
+
with gr.Row():
|
| 25 |
+
with gr.Column():
|
| 26 |
+
model = gr.Dropdown(["Qwen/Qwen2.5-Coder-14B-Instruct"], value="Qwen/Qwen2.5-Coder-14B-Instruct", label="Model")
|
| 27 |
+
samples = gr.Slider(100, 50000, 10000, label="Samples")
|
| 28 |
+
epochs = gr.Slider(1, 10, 3, label="Epochs")
|
| 29 |
+
lr = gr.Number(2e-5, label="Learning Rate")
|
| 30 |
+
hub_id = gr.Textbox("wheattoast11/agent-zero-terminals-sdk", label="Hub ID")
|
| 31 |
+
btn = gr.Button("Start Training", variant="primary")
|
| 32 |
+
with gr.Column():
|
| 33 |
+
status = gr.Markdown(get_status())
|
| 34 |
+
btn.click(start_training, [model, samples, epochs, lr, hub_id], status)
|
| 35 |
+
gr.Markdown("**Intuition Labs** | L40S ~$1.80/hr - PAUSE after training!")
|
| 36 |
+
|
| 37 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|