File size: 959 Bytes
d834810
 
 
 
 
 
 
 
 
 
 
 
 
 
d407891
08825e9
 
 
 
 
d834810
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
os.system("hub install deoldify==1.0.1")
import gradio as gr
import paddlehub as hub
from pathlib import Path


model = hub.Module(name='deoldify')

def inference(image):
    model.predict(image.name)
    return './output/DeOldify/'+Path(image.name).stem+".png"

title = "DeOldify"
description = "DeOldify的Gradio示例. 使用它, 只需要上传你的照片, 或者点击一张示例图片加载."
article = r"""
<p style='text-align: center'><a href='https://github.com/jantic/DeOldify' target='_blank'>Github Repo</a></p>
---
<h2 style="font-weight: 900; margin-bottom: 7px;">点击<a href='https://www.toolchest.cn' target='_blank'>返回智能工具箱</a>查看更多好玩的人工智能项目</h2>
"""

examples=[['lunch.jpeg']]
iface = gr.Interface(inference, inputs=gr.inputs.Image(type="file"), outputs=gr.outputs.Image(type="file"),examples=examples,enable_queue=True,title=title,article=article,description=description)
iface.launch()