Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,19 +9,24 @@ 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 |
"""
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
@tool
|
27 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
+
def most_common_letter(text: str, _: str) -> str:
|
13 |
+
"""Finds the most common alphabet letter in the given text (case-insensitive).
|
14 |
Args:
|
15 |
+
text: The input text to analyze.
|
16 |
+
_: Unused second argument.
|
17 |
"""
|
18 |
+
text = text.lower()
|
19 |
+
frequency = {}
|
20 |
+
|
21 |
+
for char in text:
|
22 |
+
if 'a' <= char <= 'z':
|
23 |
+
frequency[char] = frequency.get(char, 0) + 1
|
24 |
+
|
25 |
+
if not frequency:
|
26 |
+
return "No alphabet letters found in the input."
|
27 |
+
|
28 |
+
most_common = max(frequency.items(), key=lambda x: x[1])
|
29 |
+
return f"The most common letter is '{most_common[0]}' which appears {most_common[1]} time(s)."
|
30 |
|
31 |
@tool
|
32 |
def get_current_time_in_timezone(timezone: str) -> str:
|