diff --git a/gradio/outputs.py b/gradio/outputs.py index dbf87eb00a..3c2e5e633c 100644 --- a/gradio/outputs.py +++ b/gradio/outputs.py @@ -55,7 +55,7 @@ class Label(AbstractOutput): def postprocess(self, prediction): if isinstance(prediction, str) or isinstance(prediction, Number): - return {"label": prediction} + return {"label": str(prediction)} elif isinstance(prediction, dict): sorted_pred = sorted( prediction.items(), diff --git a/test/test_interface.py b/test/test_interface.py index fc9afbe4f1..7d1a5c3695 100644 --- a/test/test_interface.py +++ b/test/test_interface.py @@ -7,13 +7,13 @@ import gradio.outputs class TestInterface(unittest.TestCase): def test_input_output_mapping(self): - io = gr.Interface(inputs='SketCHPad', outputs='textBOX', fn=lambda x: x) + io = gr.Interface(inputs='SketCHPad', outputs='TexT', fn=lambda x: x) self.assertIsInstance(io.input_interfaces[0], gradio.inputs.Sketchpad) self.assertIsInstance(io.output_interfaces[0], gradio.outputs.Textbox) def test_input_interface_is_instance(self): inp = gradio.inputs.Image() - io = gr.Interface(inputs=inp, outputs='textBOX', fn=lambda x: x) + io = gr.Interface(inputs=inp, outputs='teXT', fn=lambda x: x) self.assertEqual(io.input_interfaces[0], inp) def test_output_interface_is_instance(self): @@ -24,7 +24,7 @@ class TestInterface(unittest.TestCase): def test_prediction(self): def model(x): return 2*x - io = gr.Interface(inputs='textbox', outputs='textBOX', fn=model) + io = gr.Interface(inputs='textbox', outputs='TEXT', fn=model) self.assertEqual(io.predict[0](11), 22) diff --git a/test/test_networking.py b/test/test_networking.py index 7002c20269..9fe0ffe9cd 100644 --- a/test/test_networking.py +++ b/test/test_networking.py @@ -27,7 +27,7 @@ class TestGetAvailablePort(unittest.TestCase): s.bind((networking.LOCALHOST_NAME, port)) # Bind to the port new_port = networking.get_first_available_port(initial, final) s.close() - self.assertFalse(port==new_port) + self.assertFalse(port == new_port) # class TestSetSampleData(unittest.TestCase):