diff --git a/modules/image/Image_editing/colorization/deoldify/README.md b/modules/image/Image_editing/colorization/deoldify/README.md index 30221d110..8d17d9a14 100644 --- a/modules/image/Image_editing/colorization/deoldify/README.md +++ b/modules/image/Image_editing/colorization/deoldify/README.md @@ -162,6 +162,8 @@ cv2.imwrite('/PATH/TO/SAVE/IMAGE', img) ``` +- ### Gradio APP 支持 + 从 PaddleHub 2.3.1 开始支持使用链接 http://127.0.0.1:8866/gradio/deoldify 在浏览器中访问 deoldify 的 Gradio APP。 ## 五、更新历史 @@ -177,6 +179,10 @@ 移除 Fluid API +* 1.2.0 + + 添加 Gradio APP 支持 + ```shell - $ hub install deoldify == 1.1.0 + $ hub install deoldify == 1.2.0 ``` diff --git a/modules/image/Image_editing/colorization/deoldify/README_en.md b/modules/image/Image_editing/colorization/deoldify/README_en.md index c08d1a68e..5ffd509ad 100644 --- a/modules/image/Image_editing/colorization/deoldify/README_en.md +++ b/modules/image/Image_editing/colorization/deoldify/README_en.md @@ -161,6 +161,8 @@ cv2.imwrite('/PATH/TO/SAVE/IMAGE', img) ``` +- ### Gradio APP support + Starting with PaddleHub 2.3.1, the Gradio APP for deoldify is supported to be accessed in the browser using the link http://127.0.0.1:8866/gradio/deoldify. ## V. Release Note @@ -176,6 +178,10 @@ Remove Fluid API +* 1.2.0 + + Add Gradio APP support + ```shell - $ hub install deoldify == 1.1.0 + $ hub install deoldify == 1.2.0 ``` diff --git a/modules/image/Image_editing/colorization/deoldify/module.py b/modules/image/Image_editing/colorization/deoldify/module.py index bcf896f49..790dc2b4e 100644 --- a/modules/image/Image_editing/colorization/deoldify/module.py +++ b/modules/image/Image_editing/colorization/deoldify/module.py @@ -33,7 +33,7 @@ author="paddlepaddle", author_email="", summary="Deoldify is a colorizaton model", - version="1.1.0") + version="1.2.0") class DeOldifyPredictor(nn.Layer): def __init__(self, render_factor: int = 32, output_path: int = 'output', load_checkpoint: str = None): @@ -163,3 +163,18 @@ def serving_method(self, images, **kwargs): results = self.run_image(img=images_decode) results = U.cv2_to_base64(results) return results + + def create_gradio_app(self): + import gradio as gr + + def inference(image): + img, _ = self.predict(image.name) + return img + + title = "DeOldify" + interface = gr.Interface(inference, + inputs=gr.inputs.Image(type="file"), + outputs=gr.outputs.Image(type="numpy"), + title=title, + allow_flagging='never') + return interface