Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,9 @@ class BasicAgent:
|
|
| 49 |
"""
|
| 50 |
if file_path.endswith(".csv"):
|
| 51 |
df = pd.read_csv(file_path)
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
df = pd.read_excel(file_path)
|
| 54 |
return df.to_string()
|
| 55 |
|
|
@@ -59,6 +61,18 @@ class BasicAgent:
|
|
| 59 |
description="Analyses images to locate and describe objects in them.",
|
| 60 |
#trust_remote_code=True,
|
| 61 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
self.agent = CodeAgent(
|
| 64 |
tools=[
|
|
@@ -68,15 +82,6 @@ class BasicAgent:
|
|
| 68 |
image_analysis_tool,
|
| 69 |
],
|
| 70 |
model=InferenceClientModel("Qwen/Qwen2.5-VL-72B-Instruct"),
|
| 71 |
-
instructions=(
|
| 72 |
-
"Answer with only the final answer value — no explanation, "
|
| 73 |
-
"no 'FINAL ANSWER' prefix, no extra formatting. "
|
| 74 |
-
"If the question references a file, first call fetch_task_file "
|
| 75 |
-
"with the given task_id to download it, then use the appropriate "
|
| 76 |
-
"tool (read_spreadsheet for tables, image_analyser for images) "
|
| 77 |
-
"to inspect it before answering. Use DuckDuckGoSearchTool only "
|
| 78 |
-
"when the question needs current or external information."
|
| 79 |
-
),
|
| 80 |
max_steps=10,
|
| 81 |
)
|
| 82 |
#answering questions
|
|
|
|
| 49 |
"""
|
| 50 |
if file_path.endswith(".csv"):
|
| 51 |
df = pd.read_csv(file_path)
|
| 52 |
+
elif file_path.edswith(".pdf"):
|
| 53 |
+
df = pd.read_pdf(file_path)
|
| 54 |
+
else:
|
| 55 |
df = pd.read_excel(file_path)
|
| 56 |
return df.to_string()
|
| 57 |
|
|
|
|
| 61 |
description="Analyses images to locate and describe objects in them.",
|
| 62 |
#trust_remote_code=True,
|
| 63 |
)
|
| 64 |
+
"""errors I get:
|
| 65 |
+
- Error initializing agent: 'type'
|
| 66 |
+
An extra system prompt:
|
| 67 |
+
instructions=(
|
| 68 |
+
"Answer with only the final answer value — no explanation, "
|
| 69 |
+
"no 'FINAL ANSWER' prefix, no extra formatting. "
|
| 70 |
+
"If the question references a file, first call fetch_task_file "
|
| 71 |
+
"with the given task_id to download it, then use the appropriate "
|
| 72 |
+
"tool (read_spreadsheet for tables, image_analyser for images) "
|
| 73 |
+
"to inspect it before answering. Use DuckDuckGoSearchTool only "
|
| 74 |
+
"when the question needs current or external information."
|
| 75 |
+
),"""
|
| 76 |
|
| 77 |
self.agent = CodeAgent(
|
| 78 |
tools=[
|
|
|
|
| 82 |
image_analysis_tool,
|
| 83 |
],
|
| 84 |
model=InferenceClientModel("Qwen/Qwen2.5-VL-72B-Instruct"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
max_steps=10,
|
| 86 |
)
|
| 87 |
#answering questions
|