|
42 | 42 | },
|
43 | 43 | {
|
44 | 44 | "cell_type": "code",
|
45 |
| - "execution_count": 2, |
| 45 | + "execution_count": 1, |
46 | 46 | "id": "bc940358",
|
47 | 47 | "metadata": {},
|
48 | 48 | "outputs": [],
|
|
71 | 71 | },
|
72 | 72 | {
|
73 | 73 | "cell_type": "code",
|
74 |
| - "execution_count": 7, |
| 74 | + "execution_count": 2, |
75 | 75 | "id": "e4078915",
|
76 | 76 | "metadata": {},
|
77 | 77 | "outputs": [
|
|
168 | 168 | },
|
169 | 169 | {
|
170 | 170 | "cell_type": "code",
|
171 |
| - "execution_count": 2, |
| 171 | + "execution_count": 3, |
172 | 172 | "id": "ab545e4c",
|
173 | 173 | "metadata": {},
|
174 | 174 | "outputs": [
|
|
210 | 210 | },
|
211 | 211 | {
|
212 | 212 | "cell_type": "code",
|
213 |
| - "execution_count": null, |
| 213 | + "execution_count": 4, |
214 | 214 | "id": "7ae4af8d",
|
215 | 215 | "metadata": {},
|
216 | 216 | "outputs": [
|
|
221 | 221 | "\n",
|
222 | 222 | "--- TRANSCRIPT ---\n",
|
223 | 223 | "\n",
|
224 |
| - "And lots of times, you need to give people more than one link at a time. A band could give their fans a couple new videos from a live concert, a behind the scenes photo gallery, an album to purchase, like these next few links.\n", |
| 224 | + "And lots of times you need to give people more than one link at a time. A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo gallery, an album to purchase, like these next few links.\n", |
225 | 225 | "\n"
|
226 | 226 | ]
|
227 | 227 | }
|
|
264 | 264 | },
|
265 | 265 | {
|
266 | 266 | "cell_type": "code",
|
267 |
| - "execution_count": 4, |
| 267 | + "execution_count": 5, |
268 | 268 | "id": "d027fdb9",
|
269 | 269 | "metadata": {},
|
270 | 270 | "outputs": [
|
271 | 271 | {
|
272 | 272 | "name": "stdout",
|
273 | 273 | "output_type": "stream",
|
274 | 274 | "text": [
|
275 |
| - "And lots of times, you need to give people more than one link at a time. A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo gallery, an album to purchase, like these next few links.\n", |
276 |
| - "And lots of times, you need to give people more than one link at a time. A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo gallery, an album to purchase, like these next few links.\n" |
| 275 | + "And lots of times you need to give people more than one link at a time. A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo gallery, an album to purchase, like these next few links.\n", |
| 276 | + "\n", |
| 277 | + "And lots of times you need to give people more than one link at a time. A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo gallery, an album to purchase, like these next few links.\n" |
277 | 278 | ]
|
278 | 279 | }
|
279 | 280 | ],
|
|
295 | 296 | " \n",
|
296 | 297 | " # When transcription is complete, you can get the final transcript using `event.text`\n",
|
297 | 298 | " elif getattr(event, \"text\", None):\n",
|
| 299 | + " print()\n", |
298 | 300 | " print(\"\\n\" + event.text)"
|
299 | 301 | ]
|
300 | 302 | },
|
|
334 | 336 | },
|
335 | 337 | {
|
336 | 338 | "cell_type": "code",
|
337 |
| - "execution_count": 23, |
| 339 | + "execution_count": 8, |
338 | 340 | "id": "c6fa0ea1",
|
339 | 341 | "metadata": {},
|
340 | 342 | "outputs": [],
|
|
446 | 448 | },
|
447 | 449 | {
|
448 | 450 | "cell_type": "code",
|
449 |
| - "execution_count": 24, |
| 451 | + "execution_count": 9, |
450 | 452 | "id": "d90de5b9",
|
451 | 453 | "metadata": {},
|
452 | 454 | "outputs": [
|
453 | 455 | {
|
454 | 456 | "name": "stdout",
|
455 | 457 | "output_type": "stream",
|
456 | 458 | "text": [
|
457 |
| - "And lots of times you need to give people more than one link at a time.A band could give theirAn fans album a couple to purchase of new videos from a live concert, a behind-the-scenes photo gallery.Like these next few links." |
| 459 | + "And lots of times you need to give people more than one link at a time.A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo galleryLike these next few linksAn album to purchase." |
458 | 460 | ]
|
459 | 461 | },
|
460 | 462 | {
|
461 | 463 | "data": {
|
462 | 464 | "text/plain": [
|
463 |
| - "'And lots of times you need to give people more than one link at a time. A band could give theirAn fans album a couple to purchase of new videos from a live concert, a behind-the-scenes photo gallery. Like these next few links.'" |
| 465 | + "'And lots of times you need to give people more than one link at a time. A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo gallery Like these next few linksAn album to purchase. '" |
464 | 466 | ]
|
465 | 467 | },
|
466 |
| - "execution_count": 24, |
| 468 | + "execution_count": 9, |
467 | 469 | "metadata": {},
|
468 | 470 | "output_type": "execute_result"
|
469 | 471 | }
|
|
543 | 545 | ")\n",
|
544 | 546 | "\n",
|
545 | 547 | "# ── 3 · helper to stream ~40 ms chunks at 24 kHz ---------------------------\n",
|
546 |
| - "def load_and_resample(path: str, sr: int = TARGET_SR) -> np.ndarray:\n", |
| 548 | + "def load_and_resample(path: str, sr: int = 24_000) -> np.ndarray:\n", |
547 | 549 | " \"\"\"Return mono PCM-16 as a NumPy array.\"\"\"\n",
|
548 | 550 | " data, file_sr = sf.read(path, dtype=\"float32\")\n",
|
549 | 551 | " if data.ndim > 1:\n",
|
|
579 | 581 | },
|
580 | 582 | {
|
581 | 583 | "cell_type": "code",
|
582 |
| - "execution_count": 25, |
| 584 | + "execution_count": 11, |
583 | 585 | "id": "611c11e0",
|
584 | 586 | "metadata": {},
|
585 | 587 | "outputs": [
|
|
589 | 591 | "text": [
|
590 | 592 | "\n",
|
591 | 593 | "[User]: And lots of times you need to give people more than one link at a time.\n",
|
592 |
| - "[Assistant]: Et souvent, vous devez donner aux gens plus d'un lien à la fois.\n", |
593 |
| - "[User]: A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo gallery,\n", |
594 |
| - "[Assistant]: Un groupe pourrait donner à ses fans quelques nouvelles vidéos d'un concert live, une galerie de photos des coulisses,\n", |
| 594 | + "[Assistant]: Et souvent, vous devez donner aux gens plusieurs liens à la fois.\n", |
| 595 | + "[User]: A band could give their fans a couple new videos from a live concert, a behind-the-scenes photo gallery.\n", |
| 596 | + "[Assistant]: Un groupe pourrait donner à ses fans quelques nouvelles vidéos d'un concert live, ainsi qu'une galerie de photos des coulisses.\n", |
595 | 597 | "[User]: An album to purchase.\n",
|
596 |
| - "[Assistant]: Un album à acheter." |
| 598 | + "[Assistant]: " |
597 | 599 | ]
|
598 | 600 | },
|
599 | 601 | {
|
600 | 602 | "name": "stdout",
|
601 | 603 | "output_type": "stream",
|
602 | 604 | "text": [
|
603 |
| - "\n", |
604 |
| - "[User]: Like these next few links.\n", |
605 |
| - "[Assistant]: Comme ces prochains liens." |
606 |
| - ] |
607 |
| - }, |
608 |
| - { |
609 |
| - "name": "stderr", |
610 |
| - "output_type": "stream", |
611 |
| - "text": [ |
612 |
| - "Error processing turns: no close frame received or sent\n" |
| 605 | + "Un album à acheter.\n", |
| 606 | + "[User]: like these next few links.\n", |
| 607 | + "[Assistant]: comme ces quelques liens suivants." |
613 | 608 | ]
|
614 | 609 | }
|
615 | 610 | ],
|
|
0 commit comments