Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,24 +37,7 @@ class LoadCsvTool(Tool):
|
|
| 37 |
output_type = "string"
|
| 38 |
|
| 39 |
def forward(self, file_path: str) -> str:
|
| 40 |
-
|
| 41 |
-
# Read CSV into DataFrame
|
| 42 |
-
df = pd.read_csv(file_path)
|
| 43 |
-
|
| 44 |
-
# Create summary
|
| 45 |
-
summary = f"CSV loaded successfully!\n\n"
|
| 46 |
-
summary += f"Rows: {len(df)}, Columns: {len(df.columns)}\n\n"
|
| 47 |
-
summary += f"Column names: {', '.join(df.columns.tolist())}\n\n"
|
| 48 |
-
summary += f"First 5 rows:\n{df.head().to_string()}\n\n"
|
| 49 |
-
summary += f"Data types:\n{df.dtypes.to_string()}\n\n"
|
| 50 |
-
summary += f"Summary statistics:\n{df.describe().to_string()}"
|
| 51 |
-
|
| 52 |
-
return summary
|
| 53 |
-
|
| 54 |
-
except FileNotFoundError:
|
| 55 |
-
return f"Error: File '{file_path}' not found!"
|
| 56 |
-
except Exception as e:
|
| 57 |
-
return f"Error loading CSV: {str(e)}".
|
| 58 |
|
| 59 |
class WikipediaTool(Tool):
|
| 60 |
name = "wikipedia_search"
|
|
|
|
| 37 |
output_type = "string"
|
| 38 |
|
| 39 |
def forward(self, file_path: str) -> str:
|
| 40 |
+
return pd.read_csv(file_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
class WikipediaTool(Tool):
|
| 43 |
name = "wikipedia_search"
|