Isaac454 commited on
Commit
e4569e2
·
verified ·
1 Parent(s): 7d0f1b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -24,6 +24,27 @@ class WebSearchTool(Tool):
24
  tool = DuckDuckGoSearchTool()
25
  return tool.forward(query)
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  class WikipediaTool(Tool):
28
  name = "wikipedia_search"
29
  description = "Fetch Wikipedia summary for a topic. Input: topic string."
 
24
  tool = DuckDuckGoSearchTool()
25
  return tool.forward(query)
26
 
27
+ class LoadCsvTool(Tool):
28
+ name = "load_csv"
29
+ description = "reads a CSV (Comma-Separated Values) file from a specified file path on the local system and loads its contents into a pandas DataFrame for further data analysis or processing."
30
+ inputs = {
31
+ "file_path": {
32
+ "type": "string",
33
+ "description": "The full path to the CSV file on the local file system. This can be an absolute or relative path."
34
+ }
35
+ }
36
+ output_type = "pd.DataFrame"
37
+
38
+ import pandas as pd
39
+
40
+ def load_csv(file_path: str) -> pd.DataFrame:
41
+ """Load a CSV file from the system"""
42
+ return pd.read_csv(file_path)
43
+ # The original path caused a SyntaxError due to backslashes being interpreted as escape sequences.
44
+ # Also, the path was incorrectly wrapped in an extra set of double quotes.
45
+ # Using a raw string (r"...") prevents this. Note: This path is a local Windows path
46
+ # and will likely not be accessible in this Colab environment.
47
+
48
  class WikipediaTool(Tool):
49
  name = "wikipedia_search"
50
  description = "Fetch Wikipedia summary for a topic. Input: topic string."