Update app.py
Browse files
app.py
CHANGED
|
@@ -79,7 +79,7 @@ class BasicAgent:
|
|
| 79 |
"(3) If a web search is needed and the answer is likely on Wikipedia, try using the wiki_url_tool to find the relevant page; "
|
| 80 |
"if that fails, search manually; if you use wikipedia, always use the wiki_tool to extract data from Wikipedia tables. They always contain the answer to your question. Carefully read and analyze them to identify the relevant table and extract the correct information based on the context of your question. Do not rely on any other sources. "
|
| 81 |
"(4) Never use synonyms not present in the question. "
|
| 82 |
-
"(5)
|
| 83 |
"(6) If you need to know the list of vegetables, you will find it with vegetable_info_retriever."
|
| 84 |
"Never make assumptions to answer a question. . If you do not know the answer, say so clearly. Always report your thoughts and finish your answer with the following template: "
|
| 85 |
"FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. "
|
|
@@ -151,11 +151,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 151 |
task_id = item.get("task_id")
|
| 152 |
question_text = item.get("question")
|
| 153 |
file_url= f"{api_url}/file/{task_id}"
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
|
|
|
| 159 |
if not task_id or question_text is None:
|
| 160 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 161 |
continue
|
|
|
|
| 79 |
"(3) If a web search is needed and the answer is likely on Wikipedia, try using the wiki_url_tool to find the relevant page; "
|
| 80 |
"if that fails, search manually; if you use wikipedia, always use the wiki_tool to extract data from Wikipedia tables. They always contain the answer to your question. Carefully read and analyze them to identify the relevant table and extract the correct information based on the context of your question. Do not rely on any other sources. "
|
| 81 |
"(4) Never use synonyms not present in the question. "
|
| 82 |
+
"(5) Some questions may include an attached file or a download link. If a file is directly provided, use it immediately. Otherwise, download the file from the link before proceeding with any further steps. If it contains an image, use image_tool to describe it. If it contains an mp3 audio, use audio_tool to translate it to text."
|
| 83 |
"(6) If you need to know the list of vegetables, you will find it with vegetable_info_retriever."
|
| 84 |
"Never make assumptions to answer a question. . If you do not know the answer, say so clearly. Always report your thoughts and finish your answer with the following template: "
|
| 85 |
"FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. "
|
|
|
|
| 151 |
task_id = item.get("task_id")
|
| 152 |
question_text = item.get("question")
|
| 153 |
file_url= f"{api_url}/file/{task_id}"
|
| 154 |
+
file_name=item.get("file_name")
|
| 155 |
+
if file_name!="":
|
| 156 |
+
attached_file = requests.get(file_url)
|
| 157 |
+
attached_file.raise_for_status()
|
| 158 |
+
else:
|
| 159 |
+
attached_file=None
|
| 160 |
if not task_id or question_text is None:
|
| 161 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 162 |
continue
|