Skip to content

Commit

Permalink
transcript edit opportunity
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarx committed Oct 6, 2022
1 parent 784e743 commit 94a3c21
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion Video_Killed_The_Radio_Star_Defusion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
]
},
{
Expand All @@ -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",
Expand Down

0 comments on commit 94a3c21

Please sign in to comment.