hkblockchaintechnology's picture
Publish preview/ from marimo
13df892 verified
Raw History Blame Contribute Delete
1.13 kB
"""Screenshot the live model card page, including the gallery."""
from pathlib import Path
from playwright.sync_api import sync_playwright
URL = "https://huggingface.co/hkblockchaintechnology/tiny-computer-agent"
OUT = Path("preview")
OUT.mkdir(exist_ok=True)
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page(viewport={"width": 1440, "height": 1080})
page.goto(URL, wait_until="load", timeout=120000)
page.wait_for_timeout(6000)
page.screenshot(path=str(OUT / "01-top.png"))
# walk down the card so every lazy image is fetched, then shoot each band
heading = page.locator("h2:has-text('Capability gallery')").first
heading.scroll_into_view_if_needed(timeout=25000)
page.wait_for_timeout(4000)
page.screenshot(path=str(OUT / "02-gallery-head.png"))
for index, step in enumerate([1400, 1500, 1600, 3000, 3000], start=3):
page.mouse.wheel(0, step)
page.wait_for_timeout(2200)
page.screenshot(path=str(OUT / f"{index:02d}-gallery.png"))
print("shot bands:", len(list(OUT.glob("*.png"))))
browser.close()
print("done")