Update app.py
Browse files
app.py
CHANGED
|
@@ -9,19 +9,23 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
-
"""
|
| 14 |
Args:
|
| 15 |
-
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
except Exception as e:
|
| 24 |
-
return f"Error: {str(e)}"
|
| 25 |
|
| 26 |
|
| 27 |
@tool
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def list_files_in_folder(folder_path: str) -> str:
|
| 13 |
+
"""Lists all files in the specified folder.
|
| 14 |
Args:
|
| 15 |
+
folder_path: The full path to the folder you want to list.
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
+
if not os.path.isdir(folder_path):
|
| 19 |
+
return f" '{folder_path}' is not a valid directory."
|
| 20 |
+
|
| 21 |
+
files = os.listdir(folder_path)
|
| 22 |
+
if not files:
|
| 23 |
+
return f" The folder '{folder_path}' is empty."
|
| 24 |
+
|
| 25 |
+
file_list = "\n".join(files)
|
| 26 |
+
return f" Files in '{folder_path}':\n{file_list}"
|
| 27 |
except Exception as e:
|
| 28 |
+
return f" Error reading folder: {str(e)}"
|
| 29 |
|
| 30 |
|
| 31 |
@tool
|