Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarx committed Oct 8, 2022
1 parent ac834e5 commit 32331ac
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions Video_Killed_The_Radio_Star_Defusion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,9 @@
" OmegaConf.save(config=storyboard, f=fp.name)\n",
"\n",
"\n",
"##############################################\n",
"\n",
"## 📥 Download audio from youtube\n",
"\n",
"###############################\n",
"# Download audio from youtube #\n",
"###############################\n",
"\n",
"video_url = storyboard.params.video_url\n",
"\n",
Expand Down Expand Up @@ -431,9 +430,9 @@
"\n",
"whisper_seg = storyboard.params.whisper_seg\n",
"\n",
"#############################################\n",
"\n",
"## 💬 Transcribe and segment speech using whisper\n",
"###################################################\n",
"# 💬 Transcribe and segment speech using whisper #\n",
"###################################################\n",
"\n",
"# handle OOM... or try to, anyway\n",
"if 'hf_helper' in locals():\n",
Expand All @@ -456,6 +455,7 @@
" audio_fpath = storyboard.params.audio_fpath\n",
" #whispers = whisper_transcribe(audio_fpath)\n",
"\n",
" # to do: dropdown selectors\n",
" segmentation_model = 'tiny'\n",
" transcription_model = 'large'\n",
"\n",
Expand Down Expand Up @@ -548,9 +548,9 @@
" with open(storyboard_fname) as fp:\n",
" OmegaConf.save(config=storyboard, f=fp.name)\n",
"\n",
"######################################################\n",
"# Review/Modify transcription\n",
"\n",
"###############################\n",
"# Review/Modify transcription #\n",
"###############################\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",
Expand Down Expand Up @@ -758,7 +758,6 @@
" print(\"archival process complete\")\n",
"\n",
"\n",
"\n",
"theme_prompt = storyboard.params.theme_prompt\n",
"display_frames_as_we_get_them = storyboard.params.display_frames_as_we_get_them\n",
"height = storyboard.params.height\n",
Expand Down Expand Up @@ -851,9 +850,9 @@
"\n",
"# @title ## 🚀 Generate animation frames\n",
"\n",
"\n",
"######################\n",
"# improved resume\n",
"###################\n",
"# improved resume #\n",
"###################\n",
"\n",
"import copy\n",
"import datetime as dt\n",
Expand Down Expand Up @@ -974,6 +973,7 @@
" , image_consistency=0.8 # @param {type:\"slider\", min:0, max:1, step:0.01} \n",
" , max_video_duration_in_seconds = 300 # @param {type:'integer'}\n",
")\n",
"d_.pop('_')\n",
"\n",
"\n",
"# @markdown `fps` - Frames-per-second of generated animations\n",
Expand Down Expand Up @@ -1084,16 +1084,15 @@
"storyboard_fname = root / 'storyboard.yaml'\n",
"storyboard = OmegaConf.load(storyboard_fname)\n",
"\n",
"#####################################\n",
"# variation parameters\n",
"# do we save this to storyboard for posterity?\n",
"########################\n",
"# rendering parameters #\n",
"########################\n",
"\n",
"output_filename = 'output.mp4' # @param {type:'string'}\n",
"add_caption = False # @param {type:'boolean'}\n",
"optimal_ordering = True # @param {type:'boolean'}\n",
"upscale = False # @param {type:'boolean'}\n",
"\n",
"\n",
"# @markdown `add_caption` - Whether or not to overlay the prompt text on the image\n",
"\n",
"# @markdown `optimal_ordering` - Intelligently permutes animation frames to provide a smoother animation.\n",
Expand All @@ -1109,10 +1108,6 @@
"if optimal_ordering:\n",
" opt_batch_size = min(storyboard.params.n_variations, max_variations_per_opt_pass)\n",
"\n",
"\n",
"#####################################\n",
"# video parameters\n",
"\n",
"# I think it might be more efficient to write the video to the local disk first, then move it\n",
"# afterwards, rather than writing into google drive\n",
"final_output_filename = str( root / output_filename )\n",
Expand All @@ -1124,6 +1119,7 @@
"\n",
"#####################################\n",
"\n",
"# helper function for readability\n",
"def process_sequence(idx):\n",
" im_paths = get_image_sequence(idx, root)\n",
" images = [Image.open(fp) for fp in im_paths]\n",
Expand Down Expand Up @@ -1188,6 +1184,8 @@
"source": [
"# @title ## 📺 Enjoy your animation!\n",
"\n",
"# to do: Merge with 'compile' cell?\n",
"\n",
"output_filename = storyboard.params.output_filename\n",
"\n",
"download_video = True # @param {type:'boolean'}\n",
Expand Down

0 comments on commit 32331ac

Please sign in to comment.