hsila commited on
Commit
fe13ef4
·
1 Parent(s): ffad893

fix: convert `word_count` output to print

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. app.py +9 -8
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ *.pyc
2
+ .gradio
app.py CHANGED
@@ -19,13 +19,9 @@ def word_count(text: str) -> str:
19
  chars = len(text)
20
  chars_no_spaces = len(text.replace(" ", ""))
21
  sentences = len(re.split(r"[.!?]+", text)) - 1
22
-
23
- return {
24
- "words": words,
25
- "characters": chars,
26
- "characters_no_spaces": chars_no_spaces,
27
- "sentences": sentences,
28
- }
29
 
30
 
31
  @tool
@@ -65,7 +61,12 @@ with open("prompts.yaml", "r") as stream:
65
 
66
  agent = CodeAgent(
67
  model=model,
68
- tools=[final_answer, get_current_time_in_timezone, word_count, DuckDuckGoSearchTool()],
 
 
 
 
 
69
  max_steps=6,
70
  verbosity_level=1,
71
  grammar=None,
 
19
  chars = len(text)
20
  chars_no_spaces = len(text.replace(" ", ""))
21
  sentences = len(re.split(r"[.!?]+", text)) - 1
22
+ print(
23
+ f"Words: {words}, Characters: {chars}, Characters (no spaces): {chars_no_spaces}, Sentences: {sentences}"
24
+ )
 
 
 
 
25
 
26
 
27
  @tool
 
61
 
62
  agent = CodeAgent(
63
  model=model,
64
+ tools=[
65
+ final_answer,
66
+ get_current_time_in_timezone,
67
+ word_count,
68
+ DuckDuckGoSearchTool(),
69
+ ],
70
  max_steps=6,
71
  verbosity_level=1,
72
  grammar=None,