Download deploy/scripts/shot_zh.js from eduzrh/helloworld: direct link, hf CLI and curl.
- Browser
- Download file 986 Bytes
-
https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/deploy/scripts/shot_zh.js
- Command line
-
hf download hf://datasets/eduzrh/helloworld/deploy/scripts/shot_zh.js
-
curl -L -o shot_zh.js https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/deploy/scripts/shot_zh.js
986 Bytes
| const { chromium } = require('playwright-core'); | |
| (async () => { | |
| const b = await chromium.launch({ | |
| executablePath: '/data/tools/chrome-headless-shell-linux64/chrome-headless-shell', | |
| args: ['--no-sandbox','--disable-dev-shm-usage','--use-gl=swiftshader','--enable-unsafe-swiftshader'], | |
| }); | |
| for (const [name, url] of [['wm_zh','http://127.0.0.1/wm/?lang=zh']]) { | |
| const ctx = await b.newContext({ viewport: { width: 1600, height: 1000 }, locale: 'zh-CN' }); | |
| const page = await ctx.newPage(); | |
| await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 }); | |
| await page.waitForTimeout(35000); | |
| await page.screenshot({ path: `/data/shots/${name}.png` }); | |
| const t = (await page.evaluate(() => document.body.innerText)).replace(/\s+/g,' '); | |
| const zh = (t.match(/[一-龥]/g) || []).length; | |
| console.log(name, 'len', t.length, 'chinese_chars', zh); | |
| console.log('HEAD:', t.slice(0, 260)); | |
| await ctx.close(); | |
| } | |
| await b.close(); | |
| })(); | |