Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,17 +12,17 @@ from Gradio_UI import GradioUI
|
|
| 12 |
@tool
|
| 13 |
def string_counter(substring:str, bigstring:str)-> str: #it's import to specify the return type
|
| 14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 15 |
-
"""A tool that counts
|
| 16 |
Args:
|
| 17 |
-
substring: a single character or a string of characters
|
| 18 |
-
bigstring: a larger string
|
| 19 |
"""
|
| 20 |
try:
|
| 21 |
# Count how many times substring is found in bigstring
|
| 22 |
count = len(re.findall(substring, bigstring))
|
| 23 |
return f"{substring} is found {count} times in the string {bigstring}"
|
| 24 |
except Exception as e:
|
| 25 |
-
return f"Error, perhaps the input is wrong and not a character or sring"
|
| 26 |
|
| 27 |
|
| 28 |
@tool
|
|
|
|
| 12 |
@tool
|
| 13 |
def string_counter(substring:str, bigstring:str)-> str: #it's import to specify the return type
|
| 14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 15 |
+
"""A tool that counts how many time a character or string is found in a larger string, the input is case-sensitive
|
| 16 |
Args:
|
| 17 |
+
substring: a single character or a string of characters, case-sensitive
|
| 18 |
+
bigstring: a larger string where the search is done, case-sensitive
|
| 19 |
"""
|
| 20 |
try:
|
| 21 |
# Count how many times substring is found in bigstring
|
| 22 |
count = len(re.findall(substring, bigstring))
|
| 23 |
return f"{substring} is found {count} times in the string {bigstring}"
|
| 24 |
except Exception as e:
|
| 25 |
+
return f"Error, perhaps the input is wrong and is not a character or sring"
|
| 26 |
|
| 27 |
|
| 28 |
@tool
|