Skip to content

Commit

Permalink
feat: stt demo
Browse files Browse the repository at this point in the history
  • Loading branch information
nekomeowww committed Dec 9, 2024
1 parent 3735157 commit ae3b946
Show file tree
Hide file tree
Showing 30 changed files with 3,021 additions and 46 deletions.
3 changes: 3 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ words:
- elevenlabs
- gltf
- hiyori
- huggingface
- iconify
- intlify
- kwaa
Expand All @@ -46,6 +47,7 @@ words:
- pinia
- pixi
- pixiv
- pretrained
- rehype
- shiki
- shikijs
Expand All @@ -57,6 +59,7 @@ words:
- unplugin
- vrma
- vueuse
- webgpu
- xsai
ignoreWords: []
import: []
7 changes: 0 additions & 7 deletions packages/stage/src/typed-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,5 @@ declare module 'vue-router/auto-routes' {
* Route name map generated by unplugin-vue-router
*/
export interface RouteNamedMap {
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
'/audio': RouteRecordInfo<'/audio', '/audio', Record<never, never>, Record<never, never>>,
'/queue': RouteRecordInfo<'/queue', '/queue', Record<never, never>, Record<never, never>>,
'/test/filter-message': RouteRecordInfo<'/test/filter-message', '/test/filter-message', Record<never, never>, Record<never, never>>,
'/test/queues/delays': RouteRecordInfo<'/test/queues/delays', '/test/queues/delays', Record<never, never>, Record<never, never>>,
'/test/queues/emotions': RouteRecordInfo<'/test/queues/emotions', '/test/queues/emotions', Record<never, never>, Record<never, never>>,
'/test/queues/messages': RouteRecordInfo<'/test/queues/messages', '/test/queues/messages', Record<never, never>, Record<never, never>>,
}
}
2 changes: 2 additions & 0 deletions packages/stt-realtime-webgpu/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
18 changes: 18 additions & 0 deletions packages/stt-realtime-webgpu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:20-alpine as build-stage

WORKDIR /app
RUN corepack enable

COPY .npmrc package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
pnpm install --frozen-lockfile

COPY . .
RUN pnpm build

FROM nginx:stable-alpine as production-stage

COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
7 changes: 7 additions & 0 deletions packages/stt-realtime-webgpu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# STT WebGPU Realtime

## Acknowledgements

Great thanks to what [Real-time Whisper WebGPU](https://huggingface.co/spaces/Xenova/realtime-whisper-webgpu) have done.

> [Source code](https://github.com/huggingface/transformers.js/tree/7a58d6e11968dd85dc87ce37b2ab37213165889a/examples/webgpu-whisper)
27 changes: 27 additions & 0 deletions packages/stt-realtime-webgpu/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Whisper Realtime (WebGPU)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0" />
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<meta name="apple-mobile-web-app-title" content="Whisper Realtime" />
<script>
;(function () {
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
const setting = localStorage.getItem('vueuse-color-scheme') || 'auto'
if (setting === 'dark' || (prefersDark && setting !== 'light'))
document.documentElement.classList.toggle('dark', true)
})()
</script>
<script src="/assets/js/CubismSdkForWeb-5-r.1/Core/live2dcubismcore.min.js"></script>
</head>
<body class="font-sans">
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<noscript> This website requires JavaScript to function properly. Please enable JavaScript to continue. </noscript>
</body>
</html>
14 changes: 14 additions & 0 deletions packages/stt-realtime-webgpu/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
button:
about: About
back: Back
go: GO
home: Home
toggle_dark: Toggle dark mode
toggle_langs: Change languages
intro:
desc: Opinionated Vite Starter Template
dynamic-route: Demo of dynamic route
hi: Hi, {name}!
aka: Also known as
whats-your-name: What's your name?
not-found: Not found
14 changes: 14 additions & 0 deletions packages/stt-realtime-webgpu/locales/zh-CN.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
button:
about: 关于
back: 返回
go: 确定
home: 首页
toggle_dark: 切换深色模式
toggle_langs: 切换语言
intro:
desc: 固执己见的 Vite 项目模板
dynamic-route: 动态路由演示
hi: 你好,{name}
aka: 也叫
whats-your-name: 输入你的名字
not-found: 未找到页面
24 changes: 24 additions & 0 deletions packages/stt-realtime-webgpu/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[build]
publish = "packages/stage/dist"
command = "pnpm run packages:stub && pnpm run build"

[build.environment]
NODE_VERSION = "22"

[[redirects]]
from = "/assets/*"
to = "/assets/:splat"
status = 200
force = true

[[redirects]]
from = "/*"
to = "/index.html"
status = 200
force = false

[[headers]]
for = "/manifest.webmanifest"

[headers.values]
Content-Type = "application/manifest+json"
58 changes: 58 additions & 0 deletions packages/stt-realtime-webgpu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "@airi-proj/stt-realtime-webgpu",
"type": "module",
"private": true,
"packageManager": "[email protected]",
"description": "Yet another WebGPU based Whisper Realtime STT re-implemented",
"author": {
"name": "Neko Ayaka",
"email": "[email protected]",
"url": "https://github.com/nekomeowww"
},
"license": "MIT",
"scripts": {
"build": "vite build",
"dev": "vite",
"lint": "eslint .",
"preview": "vite preview",
"typecheck": "vue-tsc --noEmit"
},
"dependencies": {
"@unhead/vue": "^1.11.13",
"@unocss/reset": "^0.65.0",
"@vueuse/core": "^12.0.0",
"@vueuse/head": "^2.0.0",
"nprogress": "^0.2.0",
"ofetch": "^1.4.1",
"pinia": "^2.2.8",
"vue": "^3.5.13",
"vue-demi": "^0.14.10",
"vue-i18n": "^10.0.5",
"vue-router": "^4.5.0"
},
"devDependencies": {
"@huggingface/transformers": "^3.1.2",
"@iconify-json/carbon": "^1.2.4",
"@iconify-json/eos-icons": "^1.2.1",
"@iconify-json/solar": "^1.2.1",
"@intlify/unplugin-vue-i18n": "^6.0.0",
"@shikijs/markdown-it": "^1.24.0",
"@types/markdown-it-link-attributes": "^3.0.5",
"@types/nprogress": "^0.2.3",
"@vitejs/plugin-vue": "^5.2.1",
"@vue-macros/volar": "^0.30.6",
"markdown-it-link-attributes": "^4.0.1",
"shiki": "^1.24.0",
"unplugin-auto-import": "^0.18.6",
"unplugin-vue-components": "^0.27.5",
"unplugin-vue-macros": "^2.13.4",
"unplugin-vue-markdown": "^0.27.1",
"unplugin-vue-router": "^0.10.8",
"vite-bundle-visualizer": "^1.2.1",
"vite-plugin-pwa": "^0.21.1",
"vite-plugin-vue-devtools": "^7.6.7",
"vite-plugin-vue-layouts": "^0.11.0",
"vite-plugin-webfont-dl": "^3.10.2",
"vue-tsc": "^2.1.10"
}
}
Binary file added packages/stt-realtime-webgpu/public/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/stt-realtime-webgpu/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/stt-realtime-webgpu/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<RouterView />
</template>
Loading

0 comments on commit ae3b946

Please sign in to comment.