{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "a2cd4050", "metadata": {}, "outputs": [], "source": [ "from transcribe import transcribe" ] }, { "cell_type": "code", "execution_count": 2, "id": "24e1d24e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on function transcribe in module transcribe:\n", "\n", "transcribe(path, file_type, model=None, language=None, verbose=True)\n", " Implementation of OpenAI's whisper model. Downloads model, transcribes audio files in a folder and returns the text files with transcriptions\n", "\n" ] } ], "source": [ "help(transcribe)" ] }, { "cell_type": "code", "execution_count": 3, "id": "e52477fb", "metadata": {}, "outputs": [], "source": [ "path='sample_audio/'#folder path\n", "file_type='ogg' #check your file for file type, will only transcribe files with the file type, 'ogg', 'WAV'\n", "model='medium' #'small', 'medium', 'large' (tradeoff between speed and accuracy)\n", "language= None #tries to auto-detect, other options include 'English', 'Spanish', etc...\n", "verbose = True # prints output while transcribing, False to deactivate" ] }, { "cell_type": "code", "execution_count": 4, "id": "d66866af", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Using medium model, you can change this by specifying model=\"medium\" for example\n", "Only looking for file type ogg, you can change this by specifying file_type=\"mp3\"\n", "Expecting None language, you can change this by specifying language=\"English\". None will try to auto-detect\n", "Verbosity is True. If TRUE it will print out the text as it is transcribed, you can turn this off by setting verbose=False\n", "\n", "There are 2 ogg files in path: sample_audio/\n", "\n", "\n", "Loading model...\n", "Transcribing file number number 1: sample_audio\\audio_1.ogg\n", "Model and file loaded...\n", "Starting transcription...\n", "\n", "Detecting language using up to the first 30 seconds. Use `--language` to specify the language\n", "Detected language: Swedish\n", "[00:00.000 --> 00:16.000] Hej, jag heter Axel Pettersson, jag föddes i Örebro 1976. Jag har varit Wikipedia sen 2008 och jag har översatt röstintroduktionsprojektet till svenska.\n", "\n", "Finished file number 1.\n", "\n", "\n", "\n", "Transcribing file number number 2: sample_audio\\audio_2.ogg\n", "Model and file loaded...\n", "Starting transcription...\n", "\n", "Detecting language using up to the first 30 seconds. Use `--language` to specify the language\n", "Detected language: English\n", "[00:00.000 --> 00:07.360] We're joined once again by our travel expert and also author of America's Top Roller Coasters\n", "[00:07.360 --> 00:09.200] in Amusement Parks, Pete Tribuco.\n", "[00:09.200 --> 00:11.040] Good morning and welcome back to Daybreak USA.\n", "[00:11.040 --> 00:13.480] Well, thanks for having me on.\n", "[00:13.480 --> 00:18.900] If someone's lucky enough to go on vacation to an exotic location and then maybe not so\n", "[00:18.900 --> 00:24.860] lucky to have some kind of a disaster happen while they're there, maybe some civil unrest,\n", "[00:24.860 --> 00:26.200] what should they do now?\n", "[00:26.200 --> 00:27.200] What's the next step?\n", "[00:27.840 --> 00:31.560] Well, whenever you're going on vacation, whether it's locally or internationally, you've got\n", "[00:31.560 --> 00:33.080] to be very careful.\n", "[00:33.080 --> 00:38.880] Obviously, natural disasters, they pop up, or man-made disasters pop up pretty quickly.\n", "[00:38.880 --> 00:42.800] You want to make sure that you've got a few things when you're on vacation that's important.\n", "[00:42.800 --> 00:45.100] Number one, always stay informed.\n", "[00:45.100 --> 00:48.640] When you're traveling, it's easy to find yourself, you know, distant from the world.\n", "[00:48.640 --> 00:51.920] Always know what's happening in that area that you're going to.\n", "[00:51.920 --> 00:55.840] You know, always check and see what the conditions are.\n", "[00:55.880 --> 01:00.480] And sometimes it's a place you might not want to go to, so always check that.\n", "[01:00.480 --> 01:04.160] And, you know, of course, check out all the different weather alerts.\n", "[01:04.160 --> 01:09.200] If it's a hurricane season, for example, make sure that you're aware of that.\n", "[01:09.200 --> 01:14.600] If an incident does happen, stay with a group, get a buddy, you know, travel with a buddy\n", "[01:14.600 --> 01:18.880] or somebody that you can basically go to so that you're not alone.\n", "[01:18.880 --> 01:24.040] Obviously, you want to make sure that if there's any type of a disaster, that you have a plan\n", "[01:24.040 --> 01:25.040] in place.\n", "[01:25.080 --> 01:30.440] Now, the one big thing I think everyone should do is invest in travel insurance.\n", "[01:30.440 --> 01:35.000] No matter where you are, no matter where you go, if you have that insurance program in\n", "[01:35.000 --> 01:40.480] place and know what the limitations and scenarios that it covers, it's good to have it.\n", "[01:40.480 --> 01:44.880] It's well worth paying the little extra dollars to enjoy your vacation.\n", "[01:44.880 --> 01:49.080] And, of course, connect back with your home base, you know.\n", "[01:49.080 --> 01:53.680] When you travel, you want to let people know where you're at, where you're going to be.\n", "[01:53.720 --> 01:58.320] Maybe have an itinerary with the embassy if you're going, you know, overseas and make\n", "[01:58.320 --> 02:01.440] sure that everyone knows where you're at at any given time.\n", "[02:01.440 --> 02:07.080] And, of course, during a disaster, the American Red Cross is pretty much everywhere.\n", "[02:07.080 --> 02:12.960] You want to find a location, depending on the situation of what has happened.\n", "[02:12.960 --> 02:17.960] And they'll be able to set you up, you know, with care packages and stuff along those lines.\n", "[02:17.960 --> 02:18.960] Great advice, Pete.\n", "[02:18.960 --> 02:21.160] Do you have a website where you can get more information?\n", "[02:21.400 --> 02:28.840] Yes, it is www.americasrollercoasters.tatepublishing.net.\n", "[02:28.840 --> 02:29.840] Excellent, Pete.\n", "[02:29.840 --> 02:30.840] Thanks so much.\n", "[02:30.840 --> 02:35.720] And hopefully, hopefully that'll keep some people safe on their big vacation this summer.\n", "[02:35.720 --> 02:41.280] At least having that information should help people feel a little safer anyway.\n", "[02:41.280 --> 02:42.280] It sure would.\n", "[02:42.280 --> 02:43.280] Thank you so much, sir.\n", "[02:43.280 --> 02:44.280] We'll talk again soon.\n", "[02:44.280 --> 02:45.280] Have a great day.\n", "\n", "Finished file number 2.\n", "\n", "\n", "\n" ] }, { "data": { "text/plain": [ "'Finished transcription, files can be found in sample_audio/'" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "transcribe(path, file_type, model, language, verbose)" ] }, { "cell_type": "code", "execution_count": null, "id": "c9302395", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.4" } }, "nbformat": 4, "nbformat_minor": 5 }