fix failing tests

This commit is contained in:
Ali Abid 2020-12-21 07:55:24 -08:00
parent 2b3b80f077
commit d409f9d169
2 changed files with 4 additions and 4 deletions

View File

@ -82,7 +82,7 @@ class TestImage(unittest.TestCase):
open_and_rotate,
gr.inputs.Image(shape=(30, 10), type="file"),
"image")
output = iface.process([x_img])[0][0]
output = iface.process([x_img])[0][0][0]
self.assertEqual(gr.processing_utils.decode_base64_to_image(output).size, (10, 30))

View File

@ -64,15 +64,15 @@ class TestImage(unittest.TestCase):
def test_as_component(self):
y_img = gr.processing_utils.decode_base64_to_image(gr.test_data.BASE64_IMAGE)
image_output = gr.outputs.Image()
self.assertTrue(image_output.postprocess(y_img).startswith("data:image/png;base64,iVBORw0KGgoAAA"))
self.assertTrue(image_output.postprocess(np.array(y_img)).startswith("data:image/png;base64,iVBORw0KGgoAAA"))
self.assertTrue(image_output.postprocess(y_img)[0].startswith("data:image/png;base64,iVBORw0KGgoAAA"))
self.assertTrue(image_output.postprocess(np.array(y_img))[0].startswith("data:image/png;base64,iVBORw0KGgoAAA"))
def test_in_interface(self):
def generate_noise(width, height):
return np.random.randint(0, 256, (width, height, 3))
iface = gr.Interface(generate_noise, ["slider", "slider"], "image")
self.assertTrue(iface.process([10, 20])[0][0].startswith("data:image/png;base64"))
self.assertTrue(iface.process([10, 20])[0][0][0].startswith("data:image/png;base64"))
class TestKeyValues(unittest.TestCase):
def test_in_interface(self):