Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add deoldify gradio app #2158

Merged
merged 2 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion modules/image/Image_editing/colorization/deoldify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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。

## 五、更新历史

Expand All @@ -177,6 +179,10 @@

移除 Fluid API

* 1.2.0

添加 Gradio APP 支持

```shell
$ hub install deoldify == 1.1.0
$ hub install deoldify == 1.2.0
```
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
```
17 changes: 16 additions & 1 deletion modules/image/Image_editing/colorization/deoldify/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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