audio preprocessing pipeline completed.

This commit is contained in:
timothyafolami
2024-08-09 16:33:21 +01:00
parent d7e56338eb
commit 10fc2622ec
7 changed files with 253 additions and 8 deletions
+91 -1
View File
@@ -23,6 +23,13 @@
"# !pip install pydub "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Audio Processing Pipeline"
]
},
{
"cell_type": "code",
"execution_count": 13,
@@ -233,7 +240,27 @@
"# Output the documents for verification\n",
"for doc in documents:\n",
" print(f\"Document metadata: {doc.metadata}\")\n",
" print(f\"Transcript: {doc.page_content}\") # Print first 100 characters of the transcript"
" print(f\"Transcript: {doc.page_content}\") "
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dict_keys(['filename', 'duration'])"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"doc.metadata.keys()"
]
},
{
@@ -256,6 +283,69 @@
"documents[1].metadata"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"# creating a function to create audio document\n",
"def create_audio_document(audio_file_path, chunk_duration_minutes=3):\n",
" documents = transcribe_audio_chunks(audio_file_path, chunk_duration_minutes)\n",
" return documents"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Exporting audio-1_chunks/audio-1_chunk1.mp3\n",
"Exporting audio-1_chunks/audio-1_chunk2.mp3\n",
"Exporting audio-1_chunks/audio-1_chunk3.mp3\n",
"Exporting audio-1_chunks/audio-1_chunk4.mp3\n",
"Exporting audio-1_chunks/audio-1_chunk5.mp3\n",
"Exporting audio-1_chunks/audio-1_chunk6.mp3\n",
"Exporting audio-1_chunks/audio-1_chunk7.mp3\n"
]
}
],
"source": [
"# testing the function\n",
"audio_file_path = \"data/audio-1.mp3\"\n",
"documents = create_audio_document(audio_file_path)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[Document(metadata={'filename': 'audio-1', 'duration': '0-3 minutes'}, page_content=\" Hello friend, how is it going? Welcome back to Toyota Maintenance YouTube channel. I have today in my shop this 2009 Toyota Corolla LE. She has only 90,000 miles on the odometer. I don't know this vehicle at all. It's a new customer, new car and they asked for a very detailed inspection. The inspection is successfully finished and that gives me great opportunity to talk about the most common problems with this generation of Corolla. And let's go and start with the problem which will be most expensive to repair. And I'm pointing at this car for the reason the name of it is written right here. Variable valve timing. This 1.8 liter 2Z RFE engine is equipped with the variable valve timing and if you will have a problem with it you will basically hear the rattling on the cold start. It is the known problem but I even hesitate if I should say it very common problem I personally didn see that much happening on the cars I serviced in the past And of course it always very important when you have an engine with VVT to be on top of the oil changes keeping the oil clean and possibly avoid these problems. Speaking about engine oil, we have immediately another common problem. These engines are known for engine oil consumption. Unfortunately, some of them were using or eating engine oil way faster, consuming the oil way faster than they supposed to. to. So this vehicle has a windshield sticker for 5,000 miles. All change there is still remaining 900 miles and let me show you what I discovered on my inspection. I let it sit so the oil got a chance to get all the way in the oil pan. I pulled that engine oil lipstick and of course it was confirmed it's barely touching the low mark I hope you can see it on it yeah so even this engine is consuming more than it's supposed to within a 5,000 miles\"),\n",
" Document(metadata={'filename': 'audio-1', 'duration': '3-6 minutes'}, page_content=\" It was correctly filled to the top. This is way too much. Between the marks on this engine I believe it's 1.4 quarts. So this is way too much and this engine is part of that problem. Is it catastrophic problem or something what should stop you from purchasing it? Well, that's up to debate. It will not stop me buying this vehicle. All I will have to do within 2,000 miles or 3,000 miles is check the oil. And here it's so easy to add another 1 quart of the oil. Also, 1 quart of the oil, even if you buy the full synthetic 0W-20, costs only like 7 bucks. So what's the big deal? And let's be organized and continue still or stick still with the engine oil. And we will be looking on this side passenger side of the engine. Some people will observe the oil engine oil on this side of the engine. Do you see that sensor which is coming out there? It could be leaking from that. Or we can look a little bit later when we will lift this vehicle up we can look on the back of the engine where is timing chain tensioner it a hydraulic tensioner and its gasket could be leaking surprisingly and i agree with that it on most of these i see those leaks surprisingly this one is absolutely dry i already looked from underneath this one is exception to the rule if we stay together on this side and I will bring that light for one last time right underneath the alternator hopefully you see the water pump pulley so the water pumps they don't last forever is it the common problem I will not say I will say it's common maintenance but the word common is there so these water pumps are right here driven by this belt nicely on outside it's not a timing belt moving it because this engine has timing chain so this is a relatively easy repair a little note also what do you see right here this doesn't have an automatic belt tensioner but it's manual basically through this alternator. It's right here in front of you. Maybe that light was actually not helping us. You see the tensioner? Right here. The next item is related to the ignition.\"),\n",
" Document(metadata={'filename': 'audio-1', 'duration': '6-9 minutes'}, page_content=\" 100% say that these engines to ZRFs they have it's a common that they are misfires detected you will get that check engine light and then P0 whatever codes for misfire on the multiple cylinders or on the one only and so on and so on this vehicle the owner who brought it first time here wrote it in the comment or told me in the text message he said yeah that is there is a history with misfires on this engines on this engine particle engine and there is already one or multiple coils installed as a part of that detail inspection I confirmed that I can see that number two might be Toyota but it's not matching the way it's dirty so it was replaced I believe these are Terta Danzos yes made in Japan now what will shock you somebody was taking care of that misfire they replaced the coil and to my amazement well I was not amazed about this they did obviously replace the spar plugs To my amazement they put completely wrong spark plugs in it 2009 2ZRFE 1 liter engine and I will be not discussing in this video whatsoever that 2 liter it different beast So we focus on most common engine and the most common problems in these Corollas. So somebody put in it NGK. This engine is supposed to have only Denso SC20HR11. Did I say it correctly? SC20HR11. It's already coming. I sent the report, detailed report to the owner. I said no, that doesn't belong there. It is nice and new, but it doesn't belong there. There's supposed to be only iridium acetyl-HR11. What I pulled out, newly looking, NGK, ILKAR7B11 non-iridium plug. Why is it there? Well, because somebody was in a hurry, They then maybe had no access to the SC20HR11, but most likely they wanted safe money. This is way cheaper than Iridium's power plug which goes up to 16 bucks a piece. This one maybe was 8. Eight dollars stands for somebody made 32 dollars. Like that, just cutting corners. So no way, the owner already said.\"),\n",
" Document(metadata={'filename': 'audio-1', 'duration': '9-12 minutes'}, page_content=\" We will put the correct spark plugs. I ordered them. They are on the way. Meanwhile we are making this video. And these misfires were correctly repaired by replacing the coils. It actually the service who did this work fixed the problem. They replaced the coil which was failing. So I agree with them. That's fine. just for God's sake if you can please put correct spark plugs in that engine so the owner will not have problems in the future I already inspect the remaining areas as you know me throttle body is dirty the muff it's dirty engine air filter it's on the dirty side we are going to replace it brake fluid which cannot see it's opening from here brake fluid is also dirty the battery is incorrect it's supposed to be bigger you can even see it doesn't fit in that holder i even tested it state of health it's only like 70 percent so that should be replaced too but this i'm just giving you walk around let's go back to the most common problems. Here this vehicle still have a automatic transmission dipstick If you will stick with the advice which is written on it which says no need to replace the ATF blah blah blah blah blah well don do it maintain your fluid in your transmission don't listen to those crazy stickers they were putting on these at those years that's all nonsense we know we need to change the engine oil and maintain that and we need we know that when the automatic transmission fluid is burned it's contaminated it also needs to be replaced but these automatic transmissions are not part of this video as the common problems it's exactly opposite I don't remember at the dealer and here in my mini shop I don't remember ever have one failed I'm not saying they don't but it's not a common what is common they last actually for the lifetime of the vehicle just give them nice and clean oil another common problem we will discuss right here and it actually will be two of them right in middle of your screen. Number one front wheel bearing\"),\n",
" Document(metadata={'filename': 'audio-1', 'duration': '12-15 minutes'}, page_content=\" This vehicle has only 90,000 miles but guess what? Both bearings are already showing very small play. This one I don't know why but as usually this one is smaller. It starts on this side and the other ones follow. Let me show you. Hopefully you will be able to hear it. That's a lift. There is definitely, I will say like a millimeter if I can say that, on that diameter here the movement. So it's already in the comments and we will be dealing with that problem soon. That's unfortunately pretty costly if you have to replace bows from wheel bearings. And I said there will be two items right in front of you in the middle of screen. Wheel bearing right here and the struts. Struts, I don't know why, are relatively common problem on these. Not the rear ones. The rear has also struts. I never replaced one of them ever you can see it right here nicely it's a very simple design here nothing really go bad here except we will be coming back there but for different item So the struts on both sides these ones are totally fine Now how you will see your struts are bad Well the vehicle will start kind of bouncing around but mainly even if it's on the ground You will see there will be oil even the towers below here. It will be all wrapped in the oil. When that goes it starts leaking pretty crazy and everything will be wet here. So these ones are still original OEM and they are still holding pretty good. Where we were together looking on that engine bay you didn't see any power steering reservoir also we were looking on that water pump and the belt and the belt was kind of simply going around that's because this vehicle was equipped or is equipped with electric steering apparently there were some failures on it and it was to certain degree common problem there was campaign or it was being taken care of I personally don't see it so I'm hesitating if it should be included in the common problems I don't\"),\n",
" Document(metadata={'filename': 'audio-1', 'duration': '15-18 minutes'}, page_content=\" have these problems coming to me so I will say no but I wanted make you aware that there were definitely in certain years with that electric steering there were problems with it. Last but not least unfortunately you will discover problem and it's a common problem and you will discover it in the vehicle on your dashboard. It's not this problem. This is some kind of incredible improvement by the owner. This doesn't count. So you will be driving your vehicle and suddenly you will get that check engine light on. You will have a code for EVEB and you will hope it's just a loose filler cap or the ratchet is broken on that filler cap. You will hope it's the code and in this case it will be code for a very small leak. But unfortunately these are pretty common for filling right here. I said we will be coming back here. This is that entire evap canister. It's a complicated unit and it's very expensive. So if you ever have evap codes which are saying the purge flow is incorrect or something like that pay for a correct diagnosis because these from dealer can be extremely pricey So what is my conclusion for 2009 to 2013 Corolla generation? What's conclusion? Will I buy one or will I say no? Way too problematic vehicle. I think with the correct maintenance and paying at least a little bit of attention to the engine and keeping that oil lever correctly, I think these are super great vehicles to drive from point A to point AB. Nothing exciting obviously, but they are gas savers, they are reliable and I will say in relativity of automotive world they are super cheap to maintain in my opinion the brake job everything it's easy you have a rear drum brakes in the back you can drive a lot of miles on those this one has brand new brake pads almost in front might be the first replacement at 90 000 miles The rear brake shoes I already opened that are still 2-3mm might be purely theoretically original too.\"),\n",
" Document(metadata={'filename': 'audio-1', 'duration': '18-21 minutes'}, page_content=\" this without any hesitation buy one of these to just get to the work and back and save a lot of money on the gas that's my feeling you please share underneath the video your experience with others because that's why we filming this creating community of Toyota enthusiasts who share their own own experience if you like the video give it a thumb up and be subscribed i will always have a lot of new stuff coming your way thank you for watching and have a great day my friend\")]"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"documents"
]
},
{
"cell_type": "code",
"execution_count": null,