mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-06 10:25:17 +08:00
Fixed various input interface bugs
This commit is contained in:
parent
a098a46f40
commit
caa3026d28
@ -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):
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user