Spaces:
Sleeping
Sleeping
Update app.py
Browse files39 unmodified lines404142434344454746475048495053515253545556595758596039 unmodified lines "--block_size", "256", "--learning_rate", "5e-5", ] # run training (blocking) and capture logs with open(LOG, "a", encoding="utf-8") as lf: code = subprocess.Popen(cmd, stdout=lf, stderr=subprocess.STDOUT).wait()
# after process exits, show result if code == 0 and ZIP.exists(): info = f"✅ Training complete. Saved: {OUT.name} | Zip: {ZIP.name}" return info, gr.File.update(value=str(ZIP), visible=True), ls_workspace(), read_logs() return info, gr.update(value=str(ZIP), visible=True), ls_workspace(), read_logs() else: info = f"❌ Training failed (exit {code}). See logs." return info, gr.File.update(visible=False), ls_workspace(), read_logs() return info, gr.update(visible=False), ls_workspace(), read_logs()
def read_logs(): return LOG.read_text(encoding="utf-8")[-20000:] if LOG.exists() else "⏳ Waiting…"
def refresh_download(): return gr.File.update(value=str(ZIP), visible=ZIP.exists()), ls_workspace() return gr.update(value=str(ZIP), visible=ZIP.exists()), ls_workspace()
# ---------------- Test tab ----------------def list_models():app.py+3-5