rcl-code commited on
Commit
f52cf46
·
verified ·
1 Parent(s): 5950b76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -10,7 +10,7 @@ from Gradio_UI import GradioUI
10
 
11
  response = requests.get("https://www.mit.edu/~ecprice/wordlist.10000")
12
  WORDS = response.content.splitlines()
13
-
14
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
15
  @tool
16
  def get_random_word(letter: str)-> str: #it's import to specify the return type
@@ -19,7 +19,7 @@ def get_random_word(letter: str)-> str: #it's import to specify the return type
19
  Args:
20
  letter: A string containing the first letter for the random word
21
  """
22
- letter_list = filter(str.startswith(letter), WORDS)
23
  random_word = random.choice(letter_list)
24
 
25
  return random_word
 
10
 
11
  response = requests.get("https://www.mit.edu/~ecprice/wordlist.10000")
12
  WORDS = response.content.splitlines()
13
+ FORMATED_WORDS=[barray.decode("utf-8") for barray in WORDS]
14
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
15
  @tool
16
  def get_random_word(letter: str)-> str: #it's import to specify the return type
 
19
  Args:
20
  letter: A string containing the first letter for the random word
21
  """
22
+ letter_list = [word for word in FORMATTED_WORDS if word.startswith(letter)]
23
  random_word = random.choice(letter_list)
24
 
25
  return random_word