Skip to content

Commit 28f3e88

Browse files
author
adnan wahab
committed
__
1 parent a7e67b2 commit 28f3e88

File tree

7 files changed

+201
-66
lines changed

7 files changed

+201
-66
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
200k_prs/whisper.cpp/
12
archive/
23
hardware/*
34
web-ui/archive

readme.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ incorpate -- ideas from 8 billion people
4646
https://youtu.be/y4ajXJ3nj1Q?si=CMpEXr9DBH86-9jG
4747

4848
# LLama-tools.com is an agency dedicated to helping <a href="https://worrydream.com">bret victor</a>.
49-
I met bret in 2014, at d3unconf thanks to enjalot, when i saw https://worrydream.com/SeeingSpaces/ - so i dedicated my life to turning bret's dreams into reality.
49+
I met bret in 2014, at d3unconf thanks to enjalot, when i saw https://worrydream.com/SeeingSpaces/ - so i dedicated my life to catylzing bret's dreams into reality.
50+
51+
Thank you to RMS - 1e8 new entrepreneurs * 1e6 = millionaire = 1e14 (jensen the hero - 1e14 robotics marketing according to huang)

scripts/whisper.sh

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# # To run Whisper with micromamba, follow these steps to set up the environment and install Whisper efficiently:
2+
3+
# # Step 1: Create a New Environment with micromamba
4+
5+
# # 1. Create a new environment:
6+
# # First, create a new environment for Whisper with Python 3.9 or later (required by Whisper):
7+
8+
# micromamba create -n whisper_env python=3.9
9+
10+
11+
# # 2. Activate the environment:
12+
13+
# micromamba activate whisper_env
14+
15+
16+
17+
# Step 2: Install Dependencies
18+
19+
# # 1. Install pip (if it’s not already installed):
20+
21+
# micromamba install pip
22+
23+
24+
# 2. Install Whisper using pip:
25+
# # Once the environment is activated, you can install Whisper:
26+
27+
# pip install git+https://github.com/openai/whisper.git
28+
29+
# # Alternatively, if you want the stable version from PyPI:
30+
31+
# pip install whisper
32+
33+
34+
35+
# Step 3: Install Optional Dependencies (for GPU)
36+
37+
# If you have a GPU and want to leverage it for faster transcription, you’ll need PyTorch with CUDA support:
38+
39+
#1. Install PyTorch with CUDA:
40+
41+
42+
43+
44+
#Step 4: Run Whisper
45+
46+
# Once you have Whisper and its dependencies installed, you can start transcribing audio:
47+
48+
#1. Run Whisper on an MP3 file:
49+
50+
#whisper your_audio_file.mp3 --model small
51+
52+
# You can specify different model sizes (tiny, small, medium, large) depending on your desired accuracy and performance trade-off.
53+
54+
# Example Workflow:
55+
56+
#1. Create and activate the environment:
57+
58+
micromamba create -n whisper_env python=3.9
59+
micromamba activate whisper_env
60+
micromamba install pytorch torchvision torchaudio -c pytorch
61+
62+
# If you need a specific CUDA version, you can specify it like this:
63+
64+
micromamba install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
65+
66+
67+
#2. Install Whisper:
68+
69+
# pip install whisper
70+
71+
72+
# #3. Transcribe your MP3 file:
73+
74+
# whisper ~/*.mp3 --model small
75+
76+
# ... existing code ...
77+
78+
# 2. Install Whisper:
79+
pip install openai-whisper
80+
81+
# 3. Transcribe your MP3 file:
82+
python -m whisper ~/*.mp3 --model small
83+
84+
# ... existing code ...
85+
86+
# This will produce a transcription text file in the same directory as your MP3 file.
87+
88+
# Let me know if you run into any issues!

web-ui/my-app/src/index.ts

+12-27
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,28 @@ import { serveStatic } from 'hono/serve-static';
1111
import { jwt } from 'hono/jwt';
1212
import { cors } from 'hono/cors';
1313
import { Context, Hono } from 'hono'
14-
import { webhook_receiver } from './utils.js'
1514
import * as utils from './utils.js'
1615
import send_email from './marketing.js'
1716
const Blag = utils.Blag
1817

19-
// function serveBlag(req: Request) {
20-
// console.log('filePath', filePath)
21-
// let indexHtmlContent = fs.readFileSync(filePath, "utf-8");
22-
23-
// const blag = indexHtmlContent.replace(
24-
// "{{template blag}}",
25-
// //`${renderToString(<Blag />)}`,
26-
// );
27-
28-
// return new Response(blag, {
29-
// headers: {
30-
// "Content-Type": "text/html",
31-
// },
32-
// });
33-
// }
34-
import { renderToString } from 'react-dom/server'
35-
//app.use(logger())
18+
app.use(logger())
3619
app.all('/odyssey', (c) => {
3720
const content = odyssey()
3821
return c.html(utils.Layout(content))
3922
})
4023

4124
const path = require('path')
4225

26+
27+
28+
app.post('/microphone-clicked', async (c) => {
29+
console.log('microphone-clicked')
30+
const result = await utils.start_audio_egress();
31+
32+
return c.json({ success: true, result })
33+
});
34+
35+
4336
app.all('/', function (c) {
4437
const filePath = path.resolve("src/blag.html");
4538
const html = fs.readFileSync(filePath, "utf8");
@@ -69,7 +62,7 @@ app.all('/iframe/*', (c) => {
6962
}
7063
return c.html(html)
7164
})
72-
app.post('/webhook-endpoint', webhook_receiver);
65+
app.post('/webhook', utils.webhook_receiver);
7366

7467
app.all('/_/TeleGuidance.tsx', async (c) => {
7568
console.log('htmx render ', c.req.path)
@@ -102,16 +95,8 @@ app.all('/views/*', async (c) => {
10295
})
10396
app.post('/livekit_connect', utils.livekit_connect);
10497

105-
// app.get('/api/replay_analyzer', (c) => c.json({'Pretty Blog API': 1}));
10698
console.log('app', 'hono', Date.now())
10799

108-
//
109-
//export default app
110-
//3d css react tw
111-
//app.get('/blag', (c) => c.json({'Pretty Blog API': 1}));
112-
//app.get('/blag-archive', (c) => c.json({'Pretty Blog API': 1}));
113-
//app.get('/api/magic_llama', (c) => c.json({'Pretty Blog API': 1}));
114-
//app.get('/api/measure_magic_llama', (c) => c.json({'Pretty Blog API': 1}))
115100

116101
app.all('/iframe_observablbehq', async (c) => {
117102
const response = await fetch('http://127.0.0.1:3001' + c.req.path, {

web-ui/my-app/src/llama-tools/livekit_audio.html

+19
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,25 @@ <h1>Audio Capture with LiveKit</h1>
8686

8787
// Publish the track
8888
const audioPublication = await room.localParticipant.publishTrack(audioTrack);
89+
90+
91+
92+
setTimeout(() => {
93+
fetch('/microphone-clicked', {
94+
method: 'POST',
95+
headers: {
96+
'Content-Type': 'application/json'
97+
}
98+
})
99+
.then(response => response.json())
100+
.then(data => {
101+
console.log('Success:', data); // Will contain {success: true, result: ...}
102+
})
103+
.catch(error => {
104+
console.error('Error:', error);
105+
});
106+
console.log('audio recording started')
107+
}, 2000);
89108
});
90109

91110
function handleTrackSubscribed(track, publication, participant) {

web-ui/my-app/src/odysssey/sisterschools.tsx

+22-1
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,29 @@ export default function Example() {
5757
height={48}
5858
className="col-span-2 col-start-2 max-h-12 w-full object-contain sm:col-start-auto lg:col-span-1"
5959
/>
60-
</div>
6160

61+
62+
<img
63+
alt="SICP"
64+
src="https://avatars.githubusercontent.com/u/22305925?s=200&v=4"
65+
width={158}
66+
height={48}
67+
className="col-span-2 col-start-2 max-h-12 w-full object-contain sm:col-start-auto lg:col-span-1"
68+
/>
69+
70+
<a href="https://threejs-journey.com/">
71+
<svg stroke="white" version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 58.5 66.6" style="enable-background:new 0 0 58.5 66.6;" xml:space="preserve">
72+
<path class="face-1" d="M23.1,55.7l16.1-9.3c0,0,0,0,0,0c1.1-0.7,1.8-1.9,1.8-3.1l0.1-19.1L23.1,34.4V55.7z"></path>
73+
<path class="face-2" d="M21.3,10L2.9,20.5l18,10.2l18.4-10.5c0,0,0,0-0.1,0l-17.4-10C21.7,10.1,21.5,10.1,21.3,10z"></path>
74+
<path class="face-3" d="M1.8,46.7L18,56.6c0,0,0,0,0,0c0.3,0.2,0.5,0.3,0.8,0.3V34.5L0,23.8v19.7C0,44.9,0.7,46.1,1.8,46.7z"></path>
75+
<path class="triangle-1" d="M56.8,30.4l-11.4-6.6l-0.1,19.2l11.5-6.7c1-0.6,1.7-1.7,1.7-2.9C58.5,32.1,57.9,31,56.8,30.4z"></path>
76+
<path class="triangle-2" d="M0,50.7v12.6c0,1.2,0.6,2.3,1.7,2.9c0.5,0.3,1.1,0.5,1.7,0.5c0.6,0,1.2-0.2,1.7-0.5l10.4-6L0,50.7z"></path>
77+
<path class="triangle-3" d="M16.4,7L5.1,0.5c-1-0.6-2.3-0.6-3.4,0C0.6,1.1,0,2.2,0,3.4v13.2L16.4,7z"></path>
78+
</svg>
79+
80+
81+
</a>
82+
</div>
6283
</div>
6384
</div>
6485
)

web-ui/my-app/src/utils.ts

+56-37
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,57 @@ import { serveStatic } from 'hono/serve-static';
1111
import { jwt } from 'hono/jwt';
1212
import { cors } from 'hono/cors';
1313
import { Context, Hono } from 'hono'
14-
import { webhook_receiver } from './utils.js'
1514
import { WebhookReceiver } from 'livekit-server-sdk';
16-
15+
import { LiveKitClient } from 'livekit-server-sdk';
1716
import * as utils from './utils.js'
1817

1918

2019
import { $ } from "bun"
2120

22-
const json_keys = await $`op item list --tags api --format json`.json()
23-
const shit = `#!/bin/bash
21+
const apiKey = process.env.LIVEKIT_API_KEY
22+
const apiSecret = process.env.LIVEKIT_API_SECRET
23+
const wsUrl = process.env.LIVEKIT_WS_URL
24+
const start_audio_egress = async function () {
25+
const timestamp = Date.now();
26+
const outputPath = `recordings/audio-${timestamp}.mp3`;
27+
28+
const result = await $`lk egress start \
29+
--url ${wsUrl} \
30+
--api-key ${apiKey} \
31+
--api-secret ${apiSecret} \
32+
--room example-room \
33+
--audio-only \
34+
--output ${outputPath}`;
2435

25-
# Fetch all item IDs tagged with 'api'
26-
item_ids=$(op item list --tags api --format json | jq -r '.[].id')
36+
console.log('Audio egress started:', result);
37+
return outputPath;
38+
}
39+
export { start_audio_egress }
40+
const start_egress_screeshare = async function () {
41+
42+
}
2743

28-
# Loop through each item ID and retrieve the notes
29-
for id in $item_ids; do
30-
# Get the item details in JSON
31-
item_details=$(op item get "$id" --format json)
32-
33-
# Extract the title and notes
34-
title=$(echo "$item_details" | jq -r '.overview.title')
35-
notes=$(echo "$item_details" | jq -r '.notesPlain')
36-
37-
echo "------------------------------"
38-
echo "Title: $title"
39-
echo "Notes:"
40-
echo "$notes"
41-
echo "------------------------------"
42-
done`
44+
// const json_keys = await $`op item list --tags api --format json`.json()
45+
// const shit = `#!/bin/bash
46+
47+
// # Fetch all item IDs tagged with 'api'
48+
// item_ids=$(op item list --tags api --format json | jq -r '.[].id')
49+
50+
// # Loop through each item ID and retrieve the notes
51+
// for id in $item_ids; do
52+
// # Get the item details in JSON
53+
// item_details=$(op item get "$id" --format json)
54+
55+
// # Extract the title and notes
56+
// title=$(echo "$item_details" | jq -r '.overview.title')
57+
// notes=$(echo "$item_details" | jq -r '.notesPlain')
58+
59+
// echo "------------------------------"
60+
// echo "Title: $title"
61+
// echo "Notes:"
62+
// echo "$notes"
63+
// echo "------------------------------"
64+
// done`
4365

4466
const fetchApiItems = async () => {
4567
const itemIds = await $`op item list --tags api --format json`.json();
@@ -62,22 +84,19 @@ const fetchApiItems = async () => {
6284
// console.log('api_keys', api_keys)
6385

6486

65-
const apiKey = process.env.LIVEKIT_API_KEY
66-
const apiSecret = process.env.LIVEKIT_API_SECRET
67-
const wsUrl = process.env.LIVEKIT_WS_URL
87+
88+
89+
const receiver = new WebhookReceiver('apikey', 'apisecret');
90+
6891
export const webhook_receiver = async (c: Context) => {
69-
// Event is a WebhookEvent object
70-
const event = await receiver.receive(await c.req.raw(), c.req.get('Authorization'));
71-
72-
73-
const payload = await c.req.json(); // Get JSON payload from request body
74-
console.log('Webhook received:', payload);
75-
76-
// Process the webhook data here... everything was static - an ocean of grey - except worrydream and dynamicland - that was the spark-🌈
77-
//al questions had no answers - until dynamicland.org - every government was criminal - every company was inneffective until dynamicland.org
78-
//nothing mattered until dynamicland.org
79-
console.log('event', event, payload, c.req.get('Authorization'))
80-
92+
93+
console.log('Webhook received:', );
94+
95+
const auth_header = c.req.header('Authorization')
96+
//console.log('auth_header', auth_header)
97+
//console.log(c.json())
98+
99+
81100
return c.json({ success: true });
82101
}
83102

@@ -231,7 +250,7 @@ export const indexPage = `<div>
231250

232251
// Connecting to LiveKit
233252
const json = await connect_to_livekit(jsonData);
234-
console.log('Generated token and wsUrl:', json);
253+
//console.log('Generated token and wsUrl:', json);
235254

236255
return c.json(json);
237256
}

0 commit comments

Comments
 (0)