fixed failing sketchpad validation test

This commit is contained in:
Abubakar Abid 2019-07-21 18:46:00 -07:00
parent a0238bfc46
commit 1fb8b34711
3 changed files with 14 additions and 8 deletions

View File

@ -95,7 +95,7 @@ class Sketchpad(AbstractInput):
Default preprocessing method for the SketchPad is to convert the sketch to black and white and resize 28x28
"""
im_transparent = preprocessing_utils.decode_base64_to_image(inp)
im = Image.new("RGBA", im_transparent.size, "WHITE") # Create a white rgba background
im = Image.new("RGBA", im_transparent.size, "WHITE") # Create a white background for the alpha channel
im.paste(im_transparent, (0, 0), im_transparent)
im = im.convert('L')
if self.invert_colors:

View File

@ -249,12 +249,17 @@ class Interface:
except NameError:
pass
current_pkg_version = pkg_resources.require("gradio")[0].version
latest_pkg_version = requests.get(url=PKG_VERSION_URL).json()["version"]
if StrictVersion(latest_pkg_version) > StrictVersion(current_pkg_version):
print(f"IMPORTANT: You are using gradio version {current_pkg_version}, however version {latest_pkg_version} "
f"is available, please upgrade.")
print('--------')
try:
current_pkg_version = pkg_resources.require("gradio")[0].version
latest_pkg_version = requests.get(url=PKG_VERSION_URL).json()["version"]
if StrictVersion(latest_pkg_version) > StrictVersion(current_pkg_version):
print(f"IMPORTANT: You are using gradio version {current_pkg_version}, "
f"however version {latest_pkg_version} "
f"is available, please upgrade.")
print('--------')
except: # TODO(abidlabs): don't catch all exceptions
pass
if self.verbose:
print(strings.en["BETA_MESSAGE"])
if not is_colab:

File diff suppressed because one or more lines are too long