Last active
June 26, 2023 08:17
-
-
Save chidiwilliams/7c19d476d4248d6f6d4f8885f94a3de5 to your computer and use it in GitHub Desktop.
export-buzz-cache.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"authorship_tag": "ABX9TyNKIgb2ygcEXgJSd66tjNtx", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/chidiwilliams/7c19d476d4248d6f6d4f8885f94a3de5/export-buzz-cache.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "qTRs1zrAk6ub", | |
"outputId": "d73d9499-9685-4cb8-aea8-8651176d87e3" | |
}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Cloning into 'buzz'...\n", | |
"remote: Enumerating objects: 3748, done.\u001b[K\n", | |
"remote: Counting objects: 100% (1373/1373), done.\u001b[K\n", | |
"remote: Compressing objects: 100% (393/393), done.\u001b[K\n", | |
"remote: Total 3748 (delta 1001), reused 1189 (delta 863), pack-reused 2375\u001b[K\n", | |
"Receiving objects: 100% (3748/3748), 33.01 MiB | 32.01 MiB/s, done.\n", | |
"Resolving deltas: 100% (2031/2031), done.\n" | |
] | |
} | |
], | |
"source": [ | |
"!git clone https://github.com/chidiwilliams/buzz || git -C \"buzz\" pull" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"%%capture\n", | |
"!cd buzz; git fetch; pip install -r requirements.txt" | |
], | |
"metadata": { | |
"id": "ORxdpGiZldHT" | |
}, | |
"execution_count": 8, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"import os\n", | |
"os.chdir('/content/buzz')\n", | |
"\n", | |
"import pickle\n", | |
"\n", | |
"# TODO: Copy your tasks file into the \"/content\" folder using the \"Files\" menu on the left sidebar\n", | |
"with open('/content/tasks', 'rb') as file:\n", | |
" try:\n", | |
" cache = pickle.load(file)\n", | |
" except ModuleNotFoundError:\n", | |
" pass" | |
], | |
"metadata": { | |
"id": "aynuoRrnqPCh" | |
}, | |
"execution_count": 6, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"from buzz.transcriber import write_output, OutputFormat\n", | |
"\n", | |
"for (i, task) in enumerate(cache):\n", | |
" write_output(f'/content/task-{i}.srt', task.segments, OutputFormat.SRT)\n", | |
"\n", | |
"# TODO: Right-click and refresh on the \"Files\" sidebar to see the output" | |
], | |
"metadata": { | |
"id": "9aG7gi55tdui" | |
}, | |
"execution_count": 7, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment