From 94a3c21fa95d2275ad7e4ddcacf6511a9fa9f1ee Mon Sep 17 00:00:00 2001 From: David Marx Date: Wed, 5 Oct 2022 19:16:44 -0700 Subject: [PATCH] transcript edit opportunity --- Video_Killed_The_Radio_Star_Defusion.ipynb | 45 +++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/Video_Killed_The_Radio_Star_Defusion.ipynb b/Video_Killed_The_Radio_Star_Defusion.ipynb index 5419ed5..2fd0018 100644 --- a/Video_Killed_The_Radio_Star_Defusion.ipynb +++ b/Video_Killed_The_Radio_Star_Defusion.ipynb @@ -513,7 +513,39 @@ " #storyboard.prompt_starts = prompt_starts\n", " # to do: deal with these td objects\n", " with open(storyboard_fname) as fp:\n", - " OmegaConf.save(config=storyboard, f=fp.name)" + " OmegaConf.save(config=storyboard, f=fp.name)\n", + "\n", + "######################################################\n", + "\n", + "# title # 4.b (optional) Review/Modify transcription\n", + "\n", + "# markdown Run this cell for an opportunity to review and modify the\n", + "# markdown transcription.\n", + "\n", + "import pandas as pd\n", + "import panel as pn\n", + "\n", + "# https://panel.holoviz.org/reference/widgets/Tabulator.html\n", + "pn.extension('tabulator') # I don't know that specifying 'tabulator' here is even necessary...\n", + "\n", + "tabulator_formatters = {\n", + " #'float': {'type': 'progress', 'max': 10},\n", + " 'bool': {'type': 'tickCross'}\n", + "}\n", + "\n", + "df = pd.DataFrame(prompt_starts).rename(\n", + " columns={\n", + " 'ts':'Timestamp (sec)',\n", + " 'prompt':'Lyric',\n", + " }\n", + ")\n", + "\n", + "if 'td' in df:\n", + " del df['td']\n", + "\n", + "import copy\n", + "df_pre = copy.deepcopy(df)\n", + "pn.widgets.Tabulator(df, formatters=tabulator_formatters)" ] }, { @@ -527,6 +559,17 @@ "source": [ "# @title # 5. 🧮 Math\n", "\n", + "# update prompt_starts if any changes were made above\n", + "import numpy as np\n", + "if not np.all(df_pre.values == df.values):\n", + " df_pre = copy.deepcopy(df)\n", + " for i, rec in enumerate(prompt_starts):\n", + " rec['ts'] = df['Timestamp (sec)']\n", + " rec['td'] = dt.timedelta(rec['ts'])\n", + " rec['prompt'] = df['Lyric']\n", + "\n", + "############################################\n", + "\n", "workspace = OmegaConf.load('config.yaml')\n", "OmegaConf.resolve(workspace)\n", "root = Path(workspace.project_root)\n",