File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22/deno.lock
33/dist
44/cov_profile
5- /cov_profile.lcov
5+ /cov_profile.lcov
6+ /examples /jfk.wav *
7+ /examples /node_modules
8+ /examples /package.json
9+ /examples /package-lock.json
Original file line number Diff line number Diff line change 1+ /*
2+ npm install @teaxyz/lib
3+ node whisper.js
4+ */
5+
6+ const { porcelain } = require ( "@teaxyz/lib" )
7+ const https = require ( "node:https" )
8+ const { run } = porcelain
9+ const fs = require ( "node:fs" )
10+
11+ const url = 'https://github.com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav'
12+
13+ const fetch = new Promise ( done =>
14+ https . get ( url , rsp =>
15+ rsp . pipe ( fs . createWriteStream ( "jfk.wav" ) ) . on ( 'finish' , done ) ) )
16+
17+ fetch . then ( ( ) => run ( "whisper.cpp jfk.wav" ) )
Original file line number Diff line number Diff line change 1+ /*
2+ npm install @teaxyz/lib
3+ node whisper.mjs
4+ */
5+
6+ import { porcelain } from "@teaxyz/lib"
7+ import https from "node:https"
8+ const { run } = porcelain
9+ import fs from "node:fs"
10+
11+ const url = 'https://raw.githubusercontent.com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav'
12+
13+ await new Promise ( done =>
14+ https . get ( url , rsp =>
15+ rsp . pipe ( fs . createWriteStream ( "jfk.wav" ) ) . on ( 'finish' , done ) ) )
16+
17+ await run ( "whisper.cpp jfk.wav" )
Original file line number Diff line number Diff line change 11#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run --allow-env --unstable --allow-net
22
3+ /*
4+ sh <(curl tea.xyz) https://raw.githubusercontent.com/teaxyz/lib/main/examples/whisper.ts
5+ */
6+
37import { porcelain } from "https://raw.github.com/teaxyz/lib/v0/mod.ts"
8+ import { green } from "https://deno.land/std/fmt/colors.ts"
49const { run } = porcelain
510
6- const url = 'https://raw.githubusercontent .com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav'
11+ const url = 'https://github .com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav'
712const rsp = await fetch ( url )
813await Deno . writeFile ( "jfk.wav" , rsp . body ! )
914
10- await run ( "whisper.cpp jfk.wav" )
15+ await run ( "whisper.cpp jfk.wav --output-json" )
16+
17+ const txt = Deno . readTextFileSync ( "jfk.wav.json" )
18+ const json = JSON . parse ( txt )
19+
20+ console . log ( )
21+ console . log ( green ( json . transcription [ 0 ] . text . trim ( ) ) )
You can’t perform that action at this time.
0 commit comments