MatteoFalcioni commited on
Commit ·
935bc89
1
Parent(s): f5aed9b
corrected file reading
Browse files
app.py
CHANGED
|
@@ -134,7 +134,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 134 |
continue
|
| 135 |
|
| 136 |
if file_path and os.path.exists(file_path):
|
| 137 |
-
|
| 138 |
|
| 139 |
try:
|
| 140 |
response = agent.invoke({
|
|
@@ -144,7 +144,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 144 |
]
|
| 145 |
})
|
| 146 |
submitted_answer = response["messages"][-1].content
|
| 147 |
-
time.sleep(
|
| 148 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 149 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 150 |
except Exception as e:
|
|
|
|
| 134 |
continue
|
| 135 |
|
| 136 |
if file_path and os.path.exists(file_path):
|
| 137 |
+
question_text += f"\n\nAttached file url:\n{file_path}, use it to answer the question. It could be text, image or audio, so elaborate it accordingly."
|
| 138 |
|
| 139 |
try:
|
| 140 |
response = agent.invoke({
|
|
|
|
| 144 |
]
|
| 145 |
})
|
| 146 |
submitted_answer = response["messages"][-1].content
|
| 147 |
+
time.sleep(20)
|
| 148 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 149 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 150 |
except Exception as e:
|
tools.py
CHANGED
|
@@ -45,9 +45,9 @@ def youtube_transcription_tool(url: str) -> str:
|
|
| 45 |
Args:
|
| 46 |
url: youtube video url
|
| 47 |
"""
|
| 48 |
-
loader = YoutubeLoader.from_youtube_url(
|
| 49 |
-
|
| 50 |
-
|
| 51 |
|
| 52 |
return loader.load()[0].page_content
|
| 53 |
|
|
|
|
| 45 |
Args:
|
| 46 |
url: youtube video url
|
| 47 |
"""
|
| 48 |
+
loader = YoutubeLoader.from_youtube_url(url,
|
| 49 |
+
add_video_info=False
|
| 50 |
+
)
|
| 51 |
|
| 52 |
return loader.load()[0].page_content
|
| 53 |
|