Publish tiny_computer_agent_app.py from marimo
Browse files- tiny_computer_agent_app.py +38 -1
tiny_computer_agent_app.py
CHANGED
|
@@ -1260,7 +1260,8 @@ def publish_status(
|
|
| 1260 |
for _tool in ("showcase.py", "showcase_core.py", "showcase_catalog.py"):
|
| 1261 |
if (_root / _tool).is_file():
|
| 1262 |
_files[_tool] = (_root / _tool).read_text(encoding="utf-8")
|
| 1263 |
-
_folders = [f for f in ("tiny_computer_agent", "tests", "gallery",
|
|
|
|
| 1264 |
if (_root / f).is_dir()]
|
| 1265 |
if (_root / ".github").is_dir():
|
| 1266 |
_folders.append(".github") # the CI that builds the Windows gallery
|
|
@@ -1297,6 +1298,42 @@ def publish_status(
|
|
| 1297 |
return
|
| 1298 |
|
| 1299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1300 |
@app.cell
|
| 1301 |
def demo():
|
| 1302 |
# A real screenshot -> real OCR -> labelled, clickable elements. No display needed:
|
|
|
|
| 1260 |
for _tool in ("showcase.py", "showcase_core.py", "showcase_catalog.py"):
|
| 1261 |
if (_root / _tool).is_file():
|
| 1262 |
_files[_tool] = (_root / _tool).read_text(encoding="utf-8")
|
| 1263 |
+
_folders = [f for f in ("tiny_computer_agent", "tests", "gallery",
|
| 1264 |
+
"showcase_scenes", "preview")
|
| 1265 |
if (_root / f).is_dir()]
|
| 1266 |
if (_root / ".github").is_dir():
|
| 1267 |
_folders.append(".github") # the CI that builds the Windows gallery
|
|
|
|
| 1298 |
return
|
| 1299 |
|
| 1300 |
|
| 1301 |
+
@app.cell
|
| 1302 |
+
def card_preview(readme_md):
|
| 1303 |
+
# The published model card, as it renders on the Hub right now.
|
| 1304 |
+
import json
|
| 1305 |
+
|
| 1306 |
+
from PIL import Image
|
| 1307 |
+
|
| 1308 |
+
_card_root = Path(__file__).parent # Path comes from the setup cell
|
| 1309 |
+
_gallery_index = json.loads((_card_root / "gallery" / "index.json").read_text())
|
| 1310 |
+
_preview_shots = sorted((_card_root / "preview").glob("0*.png"))
|
| 1311 |
+
|
| 1312 |
+
card_status = mo.md(
|
| 1313 |
+
f"**The published card.** {len(readme_md):,} characters, "
|
| 1314 |
+
f"{readme_md.count('<img src="gallery/')} screenshots covering "
|
| 1315 |
+
f"{len(_gallery_index)} capabilities - every public callable pictured. "
|
| 1316 |
+
f"Live at [hkblockchaintechnology/tiny-computer-agent]"
|
| 1317 |
+
f"(https://huggingface.co/hkblockchaintechnology/tiny-computer-agent)."
|
| 1318 |
+
)
|
| 1319 |
+
|
| 1320 |
+
mo.vstack(
|
| 1321 |
+
[card_status]
|
| 1322 |
+
+ (
|
| 1323 |
+
[mo.image(Image.open(shot)) for shot in _preview_shots]
|
| 1324 |
+
if _preview_shots
|
| 1325 |
+
else [
|
| 1326 |
+
mo.md(
|
| 1327 |
+
"_No preview captured yet - run `python preview/capture.py` to "
|
| 1328 |
+
"screenshot the live page._"
|
| 1329 |
+
)
|
| 1330 |
+
]
|
| 1331 |
+
)
|
| 1332 |
+
)
|
| 1333 |
+
|
| 1334 |
+
return
|
| 1335 |
+
|
| 1336 |
+
|
| 1337 |
@app.cell
|
| 1338 |
def demo():
|
| 1339 |
# A real screenshot -> real OCR -> labelled, clickable elements. No display needed:
|