Spaces:
Sleeping
Sleeping
bug fixing docstring smolagent methods
Browse files- geminiAgent.py +12 -3
geminiAgent.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import time
|
| 3 |
import operator
|
| 4 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool,
|
| 5 |
import datetime
|
| 6 |
import requests
|
| 7 |
import pytz
|
|
@@ -27,7 +27,10 @@ def ocr_tool(image: str) -> str:
|
|
| 27 |
A tool that performs OCR processing on an image.
|
| 28 |
|
| 29 |
Args:
|
| 30 |
-
image: path for the image
|
|
|
|
|
|
|
|
|
|
| 31 |
"""
|
| 32 |
image = Image.open(image)
|
| 33 |
return pytesseract.image_to_string(image)
|
|
@@ -38,7 +41,10 @@ def read_csv(csv: str) -> str:
|
|
| 38 |
Reads a CSV file and returns its contents as a human-readable string.
|
| 39 |
|
| 40 |
Args:
|
| 41 |
-
csv: path for the csv file
|
|
|
|
|
|
|
|
|
|
| 42 |
"""
|
| 43 |
csv_file = pd.read_csv(csv)
|
| 44 |
|
|
@@ -63,6 +69,9 @@ def read_excel(excel_path: str) -> str:
|
|
| 63 |
|
| 64 |
Args:
|
| 65 |
excel_path: The path to the Excel file.
|
|
|
|
|
|
|
|
|
|
| 66 |
"""
|
| 67 |
try:
|
| 68 |
df = pd.read_excel(excel_path)
|
|
|
|
| 1 |
import os
|
| 2 |
import time
|
| 3 |
import operator
|
| 4 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, tool, WikipediaSearchTool, LiteLLMModel
|
| 5 |
import datetime
|
| 6 |
import requests
|
| 7 |
import pytz
|
|
|
|
| 27 |
A tool that performs OCR processing on an image.
|
| 28 |
|
| 29 |
Args:
|
| 30 |
+
image: path for the image.
|
| 31 |
+
|
| 32 |
+
Returns:
|
| 33 |
+
Text extracted from the image.
|
| 34 |
"""
|
| 35 |
image = Image.open(image)
|
| 36 |
return pytesseract.image_to_string(image)
|
|
|
|
| 41 |
Reads a CSV file and returns its contents as a human-readable string.
|
| 42 |
|
| 43 |
Args:
|
| 44 |
+
csv: path for the csv file.
|
| 45 |
+
|
| 46 |
+
Returns:
|
| 47 |
+
A string representation of the CSV file contents.
|
| 48 |
"""
|
| 49 |
csv_file = pd.read_csv(csv)
|
| 50 |
|
|
|
|
| 69 |
|
| 70 |
Args:
|
| 71 |
excel_path: The path to the Excel file.
|
| 72 |
+
|
| 73 |
+
Returns:
|
| 74 |
+
A string representation of the Excel file contents.
|
| 75 |
"""
|
| 76 |
try:
|
| 77 |
df = pd.read_excel(excel_path)
|