Skip to content

Commit 8c895fa

Browse files
committed
save
1 parent 8469901 commit 8c895fa

6 files changed

Lines changed: 1873 additions & 39 deletions

File tree

hamel/writing.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ def generate_annotated_talk_post(slide_path,
5252
video_source, # YouTube link or local MP4 path
5353
image_dir,
5454
transcript_path=None,
55-
example_urls=_annotated_post_urls):
56-
"Assemble the prompt for the annotated post."
55+
example_urls=_annotated_post_urls,
56+
user_prompt=None):
57+
"Assemble the prompt for the annotated post. Optional user_prompt provides additional context/examples."
5758

5859
# Check if video_source is a local MP4 or YouTube URL
5960
is_local_video = Path(video_source).exists() and Path(video_source).suffix.lower() == '.mp4'
@@ -138,7 +139,9 @@ def generate_annotated_talk_post(slide_path,
138139
139140
Please go ahead and draft the post. Please also include front matter similar to the front matter in the examples and select the best slide from the talk as the cover image (which is not the title slide, but instead another interesting slide that is punchy).
140141
"""
142+
if user_prompt:
143+
prompt += f"\n\nAdditional context/instructions from the user:\n<user-context>\n{user_prompt}\n</user-context>"
141144
# Use the appropriate video source
142145
attachment = [slide_path, video_source] if is_local_video else [slide_path, video_source]
143-
draft_post = gem(prompt, attachment, model='gemini-2.5-pro')
146+
draft_post = gem(prompt, attachment, model='gemini-3-pro-preview')
144147
return draft_post

hamel/yt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def yt_chapters(url_or_path):
2121
"Generate YouTube Summary and Chapters from a video (YouTube URL or local MP4)."
2222

2323
chapter_prompt="Generate a succinct video summary (1-2 sentences) followed by video chapter timestamps for this video. Format each line of the chapter summaries as 'MM:SS - Chapter Title' (e.g., '02:30 - Introduction'). Start with 00:00. Include all major topics and transitions and be thorough - do not miss any important topics. For the summary, do not say 'In this video, we will cover the following topics', 'This video discusses..' or anything like that. Instead, reference the main speaker's name if you know it. If there is a Q&A Section, enumerate individual questions as additional chapters."
24-
return gem(prompt=chapter_prompt, o=url_or_path, model="gemini-2.5-pro")
24+
return gem(prompt=chapter_prompt, o=url_or_path, model="gemini-3-pro-preview")
2525

2626
# %% ../nbs/01_yt.ipynb 11
2727
def _extract_video_id(url: str) -> Optional[str]:

nbs/00_gem.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@
13661366
],
13671367
"metadata": {
13681368
"kernelspec": {
1369-
"display_name": "hamel",
1369+
"display_name": "Python 3 (ipykernel)",
13701370
"language": "python",
13711371
"name": "python3"
13721372
},

nbs/01_yt.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
" \"Generate YouTube Summary and Chapters from a video (YouTube URL or local MP4).\"\n",
7676
" \n",
7777
" chapter_prompt=\"Generate a succinct video summary (1-2 sentences) followed by video chapter timestamps for this video. Format each line of the chapter summaries as 'MM:SS - Chapter Title' (e.g., '02:30 - Introduction'). Start with 00:00. Include all major topics and transitions and be thorough - do not miss any important topics. For the summary, do not say 'In this video, we will cover the following topics', 'This video discusses..' or anything like that. Instead, reference the main speaker's name if you know it. If there is a Q&A Section, enumerate individual questions as additional chapters.\"\n",
78-
" return gem(prompt=chapter_prompt, o=url_or_path, model=\"gemini-2.5-pro\")"
78+
" return gem(prompt=chapter_prompt, o=url_or_path, model=\"gemini-3-pro-preview\")"
7979
]
8080
},
8181
{

0 commit comments

Comments
 (0)