Spaces:
Running
Running
Download source/studio/check_layout.py from Ethscriptions/eths: direct link, hf CLI and curl.
- Browser
- Download file 823 Bytes
-
https://huggingface.co/spaces/Ethscriptions/eths/resolve/main/source/studio/check_layout.py
- Command line
-
hf download hf://spaces/Ethscriptions/eths/source/studio/check_layout.py
-
curl -L -o check_layout.py https://huggingface.co/spaces/Ethscriptions/eths/resolve/main/source/studio/check_layout.py
823 Bytes
| import json, numpy as np, sys | |
| sys.path.insert(0,'/workspaces/studio') | |
| import render as R | |
| items=json.load(open('/workspaces/studio/items.json')) | |
| for k,it in enumerate(items,1): | |
| c=R.Clip(it,k,9,'/tmp/work/zi/06_7.webp','/tmp/work/chk/'+it['id']) | |
| for name,t in [('q',0.2),('typing',c.T['done']-0.1),('final',c.dur-0.05)]: | |
| ch=int(round(c.card_h(t))) | |
| a=np.asarray(c.content(t,int(t*30),ch).getchannel('A')) | |
| rows=(a>20).any(axis=1); cols=np.where((a>20).any(axis=0))[0] | |
| bands=[];s=None | |
| for y,v in enumerate(rows): | |
| if v and s is None: s=y | |
| if not v and s is not None: bands.append((s,y)); s=None | |
| if s is not None: bands.append((s,len(rows))) | |
| print(it['id'],name,'h',ch,'x',cols.min(),cols.max(),'bands',bands) | |
| print(' dur',round(c.dur,2)) | |