Download source/scripts/record_showcase_refinements.py from CladeTeam/ouroboros: direct link, hf CLI and curl.
- Browser
- Download file 2.75 kB
-
https://huggingface.co/spaces/CladeTeam/ouroboros/resolve/main/source/scripts/record_showcase_refinements.py
- Command line
-
hf download hf://spaces/CladeTeam/ouroboros/source/scripts/record_showcase_refinements.py
-
curl -L -o record_showcase_refinements.py https://huggingface.co/spaces/CladeTeam/ouroboros/resolve/main/source/scripts/record_showcase_refinements.py
2.75 kB
| """Record pair-wise sharing, dense residues and the Atlas description reveal.""" | |
| import os | |
| from pathlib import Path | |
| from playwright.sync_api import sync_playwright | |
| out=Path('artifacts/refinements-20261110') | |
| with sync_playwright() as p: | |
| browser=p.chromium.launch(executable_path=os.environ.get('CHROMIUM_PATH'),args=['--no-sandbox','--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader']) | |
| context=browser.new_context(viewport={'width':1440,'height':1000},record_video_dir=str(out/'recording'),record_video_size={'width':1440,'height':1000}) | |
| page=context.new_page();page.goto(os.environ.get('PREVIEW_URL','http://127.0.0.1:7860'),wait_until='networkidle') | |
| page.evaluate('document.fonts.ready') | |
| def story(value): | |
| page.locator('.story-scroll').evaluate('(e,p)=>{const s=e.querySelector(".story-stage");window.scrollTo({top:scrollY+e.getBoundingClientRect().top-82+(e.offsetHeight-s.offsetHeight)*p,behavior:"instant"})}',value) | |
| story(.835);page.wait_for_timeout(900) | |
| page.evaluate('''async()=>{ | |
| const e=document.querySelector('.story-scroll'),s=e.querySelector('.story-stage'); | |
| const top=scrollY+e.getBoundingClientRect().top-82,span=e.offsetHeight-s.offsetHeight; | |
| let from=.835; | |
| for(const [target,duration] of [[.924,2800],[.967,3000],[1,1800]]){ | |
| await new Promise(resolve=>{const start=performance.now();function tick(now){const t=Math.min(1,(now-start)/duration);window.scrollTo({top:top+span*(from+(target-from)*t),behavior:'instant'});if(t<1)requestAnimationFrame(tick);else resolve();}requestAnimationFrame(tick);}); | |
| from=target;await new Promise(r=>setTimeout(r,800)); | |
| } | |
| }''') | |
| story(.34);page.wait_for_timeout(500) | |
| page.evaluate('''async()=>{const e=document.querySelector('.story-scroll'),s=e.querySelector('.story-stage'),top=scrollY+e.getBoundingClientRect().top-82,span=e.offsetHeight-s.offsetHeight; | |
| await new Promise(resolve=>{const start=performance.now();function tick(now){const t=Math.min(1,(now-start)/3700);window.scrollTo({top:top+span*(.34+.135*t),behavior:'instant'});if(t<1)requestAnimationFrame(tick);else resolve();}requestAnimationFrame(tick);});}''') | |
| page.wait_for_timeout(1000) | |
| page.locator('.atlas-coverage-story').first.evaluate("e=>window.scrollTo({top:scrollY+e.getBoundingClientRect().top-150,behavior:'instant'})");page.wait_for_timeout(2200) | |
| page.locator('.atlas-preview-layout').evaluate("e=>window.scrollTo({top:scrollY+e.getBoundingClientRect().top-100,behavior:'instant'})");page.wait_for_timeout(1000) | |
| page.get_by_role('button',name='Ouroboros descriptions',exact=True).click();page.wait_for_timeout(2700) | |
| video=page.video;context.close();video.save_as(str(out/'refinements-preview.webm'));video.delete();browser.close() | |
| print(out/'refinements-preview.webm') | |