Skip to content

Commit eec0e5d

Browse files
committed
First example with Kernel Memory
1 parent 0135cf9 commit eec0e5d

30 files changed

+2062
-204
lines changed

01_basic/00_test_plugin.ipynb

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 4,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"Extracting auio file from video S:\\Downloads\\1.mp4\n",
13+
"Extracting transcript from audio file S:\\Downloads\\1.wav\n",
14+
"Using device: cuda:0 to run whisper with model large-v3\n",
15+
"Detected language: Italian\n"
16+
]
17+
},
18+
{
19+
"name": "stderr",
20+
"output_type": "stream",
21+
"text": [
22+
"100%|██████████| 737030/737030 [3:52:51<00:00, 52.75frames/s] "
23+
]
24+
},
25+
{
26+
"name": "stdout",
27+
"output_type": "stream",
28+
"text": [
29+
"extracted 2162 audio segments\n"
30+
]
31+
},
32+
{
33+
"name": "stderr",
34+
"output_type": "stream",
35+
"text": [
36+
"\n"
37+
]
38+
},
39+
{
40+
"ename": "UnicodeEncodeError",
41+
"evalue": "'charmap' codec can't encode character '\\u1edb' in position 2725: character maps to <undefined>",
42+
"output_type": "error",
43+
"traceback": [
44+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
45+
"\u001b[1;31mUnicodeEncodeError\u001b[0m Traceback (most recent call last)",
46+
"Cell \u001b[1;32mIn[4], line 8\u001b[0m\n\u001b[0;32m 6\u001b[0m file \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mS:\u001b[39m\u001b[38;5;130;01m\\\\\u001b[39;00m\u001b[38;5;124mDownloads\u001b[39m\u001b[38;5;130;01m\\\\\u001b[39;00m\u001b[38;5;124m1.mp4\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 7\u001b[0m audio \u001b[38;5;241m=\u001b[39m av\u001b[38;5;241m.\u001b[39mextract_audio(file)\n\u001b[1;32m----> 8\u001b[0m \u001b[43mav\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtranscript_timeline\u001b[49m\u001b[43m(\u001b[49m\u001b[43maudio\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mlarge-v3\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
47+
"File \u001b[1;32mc:\\develop\\github\\SemanticKernelPlayground\\01_basic\\plugins\\AudioVideoPlugin\\AudioVideo.py:85\u001b[0m, in \u001b[0;36mAudioVideo.transcript_timeline\u001b[1;34m(self, audiofile, model)\u001b[0m\n\u001b[0;32m 83\u001b[0m \u001b[38;5;66;03m# Write all raw_transcription_string to a file\u001b[39;00m\n\u001b[0;32m 84\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mopen\u001b[39m(text_path, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mw\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m file:\n\u001b[1;32m---> 85\u001b[0m \u001b[43mfile\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mwrite\u001b[49m\u001b[43m(\u001b[49m\u001b[43mraw_transcription_string\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 86\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m transcription_string\n",
48+
"File \u001b[1;32m~\\anaconda3\\lib\\encodings\\cp1252.py:19\u001b[0m, in \u001b[0;36mIncrementalEncoder.encode\u001b[1;34m(self, input, final)\u001b[0m\n\u001b[0;32m 18\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mencode\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;28minput\u001b[39m, final\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m):\n\u001b[1;32m---> 19\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcodecs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcharmap_encode\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\u001b[43mencoding_table\u001b[49m\u001b[43m)\u001b[49m[\u001b[38;5;241m0\u001b[39m]\n",
49+
"\u001b[1;31mUnicodeEncodeError\u001b[0m: 'charmap' codec can't encode character '\\u1edb' in position 2725: character maps to <undefined>"
50+
]
51+
}
52+
],
53+
"source": [
54+
"from plugins.AudioVideoPlugin.AudioVideo import AudioVideo\n",
55+
"\n",
56+
"av = AudioVideo()\n",
57+
"\n",
58+
"#file = \"C:\\\\temp\\\\230Github.mp4\"\n",
59+
"file = \"S:\\\\OneDrive\\\\Youtube\\\\Montaggi\\\\AtlasLocalOnWindows.mp4\"\n",
60+
"audio = av.extract_audio(file)\n",
61+
"av.transcript_timeline(audio, model = \"large-v3\")"
62+
]
63+
},
64+
{
65+
"cell_type": "code",
66+
"execution_count": 5,
67+
"metadata": {},
68+
"outputs": [
69+
{
70+
"ename": "NameError",
71+
"evalue": "name 'transcription_string' is not defined",
72+
"output_type": "error",
73+
"traceback": [
74+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
75+
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
76+
"Cell \u001b[1;32mIn[5], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m ( \u001b[43mtranscription_string\u001b[49m)\n",
77+
"\u001b[1;31mNameError\u001b[0m: name 'transcription_string' is not defined"
78+
]
79+
}
80+
],
81+
"source": [
82+
"print ( transcription_string)"
83+
]
84+
}
85+
],
86+
"metadata": {
87+
"kernelspec": {
88+
"display_name": "skernel",
89+
"language": "python",
90+
"name": "python3"
91+
},
92+
"language_info": {
93+
"codemirror_mode": {
94+
"name": "ipython",
95+
"version": 3
96+
},
97+
"file_extension": ".py",
98+
"mimetype": "text/x-python",
99+
"name": "python",
100+
"nbconvert_exporter": "python",
101+
"pygments_lexer": "ipython3",
102+
"version": "3.10.9"
103+
}
104+
},
105+
"nbformat": 4,
106+
"nbformat_minor": 2
107+
}

0 commit comments

Comments
 (0)