Spaces:
Sleeping
Sleeping
Alexandre Gazola
commited on
Commit
·
329b8f3
1
Parent(s):
453e86e
test
Browse files- app.py +3 -3
- count_max_bird_species_tool.py +3 -3
- requirements.txt +2 -1
app.py
CHANGED
@@ -15,7 +15,7 @@ from langchain_core.messages import SystemMessage
|
|
15 |
|
16 |
# --- Custom Tools ---
|
17 |
from wikipedia_tool import wikipedia_revision_by_year_keyword
|
18 |
-
from count_max_bird_species_tool import
|
19 |
from image_to_text_tool import image_to_text
|
20 |
from internet_search_tool import internet_search
|
21 |
from botanical_classification_tool import get_botanical_classification
|
@@ -36,7 +36,7 @@ class LangChainAgent:
|
|
36 |
|
37 |
tools = [
|
38 |
wikipedia_revision_by_year_keyword,
|
39 |
-
|
40 |
image_to_text,
|
41 |
internet_search,
|
42 |
get_botanical_classification,
|
@@ -137,7 +137,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
137 |
try:
|
138 |
file_name = item.get("file_name")
|
139 |
#provisorio
|
140 |
-
if not file_name:
|
141 |
continue
|
142 |
question_text_for_agent = question_text
|
143 |
if file_name:
|
|
|
15 |
|
16 |
# --- Custom Tools ---
|
17 |
from wikipedia_tool import wikipedia_revision_by_year_keyword
|
18 |
+
from count_max_bird_species_tool import count_max_bird_species_in_video
|
19 |
from image_to_text_tool import image_to_text
|
20 |
from internet_search_tool import internet_search
|
21 |
from botanical_classification_tool import get_botanical_classification
|
|
|
36 |
|
37 |
tools = [
|
38 |
wikipedia_revision_by_year_keyword,
|
39 |
+
count_max_bird_species_in_video,
|
40 |
image_to_text,
|
41 |
internet_search,
|
42 |
get_botanical_classification,
|
|
|
137 |
try:
|
138 |
file_name = item.get("file_name")
|
139 |
#provisorio
|
140 |
+
if not file_name and "birds" not in question_text:
|
141 |
continue
|
142 |
question_text_for_agent = question_text
|
143 |
if file_name:
|
count_max_bird_species_tool.py
CHANGED
@@ -4,7 +4,7 @@ from langchain_core.tools import tool
|
|
4 |
from utils import decode_base64_to_frame
|
5 |
|
6 |
@tool
|
7 |
-
def
|
8 |
"""
|
9 |
Count the maximum number of bird species in a YouTube video.
|
10 |
|
@@ -16,9 +16,9 @@ def count_max_distinct_bird_species_in_video(youtube_url: str) -> int:
|
|
16 |
"""
|
17 |
|
18 |
frames = sample_youtube_video(youtube_url, 5)
|
19 |
-
return
|
20 |
|
21 |
-
def
|
22 |
"""
|
23 |
Count the maximum number of bird species in a single frame considering a list of frames.
|
24 |
|
|
|
4 |
from utils import decode_base64_to_frame
|
5 |
|
6 |
@tool
|
7 |
+
def count_max_bird_species_in_video(youtube_url: str) -> int:
|
8 |
"""
|
9 |
Count the maximum number of bird species in a YouTube video.
|
10 |
|
|
|
16 |
"""
|
17 |
|
18 |
frames = sample_youtube_video(youtube_url, 5)
|
19 |
+
return count_max_bird_species(frames)
|
20 |
|
21 |
+
def count_max_dbird_species(framesStr: list[str]) -> int:
|
22 |
"""
|
23 |
Count the maximum number of bird species in a single frame considering a list of frames.
|
24 |
|
requirements.txt
CHANGED
@@ -17,4 +17,5 @@ whisper
|
|
17 |
yt-dlp
|
18 |
wikipedia-api
|
19 |
google-generativeai
|
20 |
-
openpyxl
|
|
|
|
17 |
yt-dlp
|
18 |
wikipedia-api
|
19 |
google-generativeai
|
20 |
+
openpyxl
|
21 |
+
tabulate
|