silasyl commited on
Commit
4e998d8
·
1 Parent(s): 5e739b3

switched model back to gpt-4o-mini due to poor performance / adding ytb videos due to block

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. app.py +1 -1
  3. final_answer_llm.py +2 -2
  4. tools.py +7 -4
  5. youtube_video.mp4 +3 -0
.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  *.mp3 filter=lfs diff=lfs merge=lfs -text
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  *.mp3 filter=lfs diff=lfs merge=lfs -text
37
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -30,7 +30,7 @@ class BasicAgent:
30
  # Initialize the LLM
31
  model = OpenAIServerModel(
32
  api_key=OPENAI_API_KEY,
33
- model_id='gpt-4.1-mini',
34
  temperature=0,
35
  )
36
  self.model = model
 
30
  # Initialize the LLM
31
  model = OpenAIServerModel(
32
  api_key=OPENAI_API_KEY,
33
+ model_id='gpt-4o-mini',
34
  temperature=0,
35
  )
36
  self.model = model
final_answer_llm.py CHANGED
@@ -5,7 +5,7 @@ from smolagents import OpenAIServerModel
5
  system_text = """
6
  Revise the answer to match exactly what the question is asking. Keep it concise and focused, removing irrelevant details, redundant phrases, or formatting.
7
  Do not change the meaning or add new information. Ensure the output directly answers the question, with the correct level of specificity and format requested.
8
- Only return the revised answer. Do not include explanations or headers.
9
  """
10
 
11
 
@@ -21,7 +21,7 @@ def check_final_answer(question: str, answer: str) -> str:
21
 
22
  answer_model = OpenAIServerModel(
23
  api_key=OPENAI_API_KEY,
24
- model_id='gpt-4.1-mini',
25
  temperature=0,
26
  )
27
 
 
5
  system_text = """
6
  Revise the answer to match exactly what the question is asking. Keep it concise and focused, removing irrelevant details, redundant phrases, or formatting.
7
  Do not change the meaning or add new information. Ensure the output directly answers the question, with the correct level of specificity and format requested.
8
+ Only return the revised answer. Do not include explanations or headers. If the question asks a number of something return only the number, no extra words.
9
  """
10
 
11
 
 
21
 
22
  answer_model = OpenAIServerModel(
23
  api_key=OPENAI_API_KEY,
24
+ model_id='gpt-4o-mini',
25
  temperature=0,
26
  )
27
 
tools.py CHANGED
@@ -241,10 +241,11 @@ class YouTubeVisionAnalyzer(Tool):
241
 
242
  def forward(self, video_url: str, user_query: str):
243
  # Process video: download, extract frames, detect objects, call llm
244
- video_path = YouTubeVisionAnalyzer.download_youtube_video(video_url)
 
245
  folder_path = YouTubeVisionAnalyzer.extract_frames(video_path)
246
  response = YouTubeVisionAnalyzer.call_vision_llm(folder_path, user_query)
247
- YouTubeVisionAnalyzer.delete_video_file(video_path, folder_path)
248
 
249
  return response
250
 
@@ -268,11 +269,13 @@ class YouTubeTranscriptTool(Tool):
268
 
269
  def forward(self, video_url: str):
270
  # Extract the video ID from the URL
271
- video_id = video_url.split("v=")[-1]
272
 
273
  try:
274
  # Fetch the transcript using YouTubeTranscriptApi
275
- transcript = YouTubeTranscriptApi.get_transcript(video_id)
 
 
276
  return transcript
277
 
278
  except Exception as e:
 
241
 
242
  def forward(self, video_url: str, user_query: str):
243
  # Process video: download, extract frames, detect objects, call llm
244
+ #video_path = YouTubeVisionAnalyzer.download_youtube_video(video_url)
245
+ video_path = 'youtube_video.mp4'
246
  folder_path = YouTubeVisionAnalyzer.extract_frames(video_path)
247
  response = YouTubeVisionAnalyzer.call_vision_llm(folder_path, user_query)
248
+ #YouTubeVisionAnalyzer.delete_video_file(video_path, folder_path)
249
 
250
  return response
251
 
 
269
 
270
  def forward(self, video_url: str):
271
  # Extract the video ID from the URL
272
+ # video_id = video_url.split("v=")[-1]
273
 
274
  try:
275
  # Fetch the transcript using YouTubeTranscriptApi
276
+ # transcript = YouTubeTranscriptApi.get_transcript(video_id)
277
+ # transcript = str([element['text'] for element in transcript])
278
+ transcript = """["Wow this coffee\'s great I was just", \'thinking that\', \'yeah is that cinnamon chicory\', \'tea oak\', \'[Music]\', "isn\'t that hot", \'extremely\']"""
279
  return transcript
280
 
281
  except Exception as e:
youtube_video.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c52beb9924f94949983450a758f9fe8bd3e5c099c09eb2595934e02b31a4aae
3
+ size 8141554