This commit is contained in:
Ali Abid 2022-04-19 02:06:38 -07:00
parent ba9eebf934
commit 7a1618accf
5 changed files with 10 additions and 18 deletions

View File

@ -2898,12 +2898,6 @@ class Model3D(Component):
**super().get_template_context(),
}
@classmethod
def get_shortcut_implementations(cls):
return {
"Model3D": {},
}
def preprocess_example(self, x):
return {"name": x, "data": None, "is_example": True}
@ -3214,12 +3208,6 @@ class Plot(Component):
def get_template_context(self):
return {**super().get_template_context()}
@classmethod
def get_shortcut_implementations(cls):
return {
"plot": {},
}
def postprocess(self, y):
"""
Parameters:

View File

@ -512,4 +512,4 @@ class Image3D(C_Model3D):
"Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components",
DeprecationWarning,
)
super().__init__(label, optional=optional)
super().__init__(label=label, optional=optional)

View File

@ -763,8 +763,10 @@ class TestImage3D(unittest.TestCase):
self.assertEqual(
Image3D_input.get_template_context(),
{
"optional": False,
"clearColor": None,
"name": "image3d",
"css": {},
"interactive": None,
"label": "Upload Your 3D Image Model",
},
)
@ -778,7 +780,7 @@ class TestImage3D(unittest.TestCase):
def test_in_interface(self):
Image3D = media_data.BASE64_MODEL3D
iface = gr.Interface(lambda x: x, "Model3D", "Model3D")
iface = gr.Interface(lambda x: x, "model3d", "model3d")
self.assertEqual(
iface.process([Image3D])[0]["data"],
Image3D["data"].replace("@file/gltf", ""),

View File

@ -557,11 +557,11 @@ class TestImage3D(unittest.TestCase):
to_save = Image3D_output.save_flagged(
tmpdirname, "Image3D_output", media_data.BASE64_MODEL3D, None
)
self.assertEqual("Image3D_output/0.gltf", to_save)
self.assertEqual("Image3D_output/0", to_save)
to_save = Image3D_output.save_flagged(
tmpdirname, "Image3D_output", media_data.BASE64_MODEL3D, None
)
self.assertEqual("Image3D_output/1.gltf", to_save)
self.assertEqual("Image3D_output/1", to_save)
if __name__ == "__main__":

View File

@ -45,7 +45,9 @@ class TestRoutes(unittest.TestCase):
self.assertEqual(output["data"], ["testtest"])
def test_state(self):
def predict(input, history=""):
def predict(input, history):
if history is None:
history = ""
history += input
return history, history