HarshatheeswaReddy commited on
Commit
6dbfe82
·
verified ·
1 Parent(s): 12791ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
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 get_github_repo_info(repo_full_name: str) -> str:
13
- """Fetch basic info about a GitHub repository.
14
  Args:
15
- repo_full_name: The full name of the repo (e.g., 'owner/repo').
16
  """
17
  try:
18
- response = requests.get(f"https://api.github.com/repos/{repo_full_name}")
19
- if response.status_code != 200:
20
- return f"Failed to fetch data: {response.json().get('message', 'Unknown error')}"
21
- data = response.json()
22
- return f"📦 {data['full_name']}\n⭐ Stars: {data['stargazers_count']}\n🍴 Forks: {data['forks_count']}\n📄 Description: {data['description']}"
 
 
 
 
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