Fixed various input interface bugs

This commit is contained in:
Abubakar Abid 2021-04-30 00:42:29 -04:00
parent a098a46f40
commit caa3026d28
2 changed files with 5 additions and 5 deletions

View File

@ -181,7 +181,7 @@ class Textbox(InputComponent):
result.append((self.interpretation_separator, 0))
return result
def _embed_text(text):
def _embed_text(self, text):
"""
Figures out a "reasonable" embedding for any particular text. Did it this way to avoid loading any
external machine learning models, which would be slow and require additional dependencies.
@ -195,7 +195,7 @@ class Textbox(InputComponent):
Embeds an arbitrary text based on word frequency
"""
if self.type == "str":
return _embed_text(x)
return self._embed_text(x)
elif self.type == "number":
return [float(x)]
else:
@ -1102,10 +1102,10 @@ class Sketchpad(InputComponent):
im = im.resize((self.image_width, self.image_height))
if self.flatten:
array = np.array(im).flatten().reshape(
1, self.image_width * self.image_height)
(1, self.image_width * self.image_height))
else:
array = np.array(im).flatten().reshape(
1, self.image_width, self.image_height)
(1, self.image_width, self.image_height))
return array
def process_example(self, example):

View File

@ -65,7 +65,7 @@ def ipython_check():
def readme_to_html(article):
try:
response = requests.get(article, timeout=3)
if response.status_code == requests.codes.ok:
if response.status_code == requests.codes.ok: #pylint: disable=no-member
article = response.text
except requests.exceptions.RequestException:
pass