Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -134,7 +134,8 @@ title = "GFPGAN: Practical Face Restoration Algorithm"
|
|
134 |
description = r"""Gradio demo for <a href='https://github.com/TencentARC/GFPGAN' target='_blank'><b>GFPGAN: Towards Real-World Blind Face Restoration with Generative Facial Prior</b></a>.<br>
|
135 |
It can be used to restore your **old photos** or improve **AI-generated faces**.<br>
|
136 |
To use it, simply upload your image.<br>
|
137 |
-
If GFPGAN is helpful, please help to ⭐ the <a href='https://github.com/TencentARC/GFPGAN' target='_blank'>Github Repo</a> and recommend it to your friends
|
|
|
138 |
"""
|
139 |
article = r"""
|
140 |
|
@@ -147,26 +148,31 @@ If you have any question, please email 📧 `[email protected]` or `xintao
|
|
147 |
<center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_GFPGAN' alt='visitor badge'></center>
|
148 |
<center><img src='https://visitor-badge.glitch.me/badge?page_id=Gradio_Xintao_GFPGAN' alt='visitor badge'></center>
|
149 |
"""
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
gr.
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
gr.
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
|
|
|
|
|
|
|
|
|
|
171 |
demo.queue(concurrency_count=4)
|
172 |
demo.launch()
|
|
|
134 |
description = r"""Gradio demo for <a href='https://github.com/TencentARC/GFPGAN' target='_blank'><b>GFPGAN: Towards Real-World Blind Face Restoration with Generative Facial Prior</b></a>.<br>
|
135 |
It can be used to restore your **old photos** or improve **AI-generated faces**.<br>
|
136 |
To use it, simply upload your image.<br>
|
137 |
+
If GFPGAN is helpful, please help to ⭐ the <a href='https://github.com/TencentARC/GFPGAN' target='_blank'>Github Repo</a> and recommend it to your friends 😊<br>
|
138 |
+
This demo was forked by [vicalloy](https://github.com/vicalloy), add `face blur` param to optimize painting face enhance.
|
139 |
"""
|
140 |
article = r"""
|
141 |
|
|
|
148 |
<center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_GFPGAN' alt='visitor badge'></center>
|
149 |
<center><img src='https://visitor-badge.glitch.me/badge?page_id=Gradio_Xintao_GFPGAN' alt='visitor badge'></center>
|
150 |
"""
|
151 |
+
with gr.Blocks() as demo:
|
152 |
+
gr.Markdown("<center><h1>%s</h1></center>" % title)
|
153 |
+
gr.Markdown(description)
|
154 |
+
with gr.Row(equal_height=False):
|
155 |
+
with gr.Column():
|
156 |
+
file_path = gr.components.Image(type="filepath", label="Input")
|
157 |
+
version = gr.components.Radio(['v1.2', 'v1.3', 'v1.4', 'RestoreFormer'], type="value", value='v1.4', label='version')
|
158 |
+
rescaling_factor = gr.components.Number(label="Rescaling factor", value=2)
|
159 |
+
blur_face = gr.components.Number(label="Blur face", value=25)
|
160 |
+
submit = gr.Button("Submit")
|
161 |
+
with gr.Column():
|
162 |
+
output_img = gr.components.Image(type="numpy", label="Output (The whole image)")
|
163 |
+
download = gr.components.File(label="Download the output image")
|
164 |
+
with gr.Row():
|
165 |
+
with gr.Column():
|
166 |
+
input_faces = gr.Gallery(label="Input faces").style(grid=[2], height="auto")
|
167 |
+
with gr.Column():
|
168 |
+
output_faces = gr.Gallery(label="Output faces").style(grid=[2], height="auto")
|
169 |
+
gr.Examples([['HanamichiSakuragi.jpg', 'v1.4', 2, 31], ['LiShiming.jpg', 'v1.4', 2, 3], ['QianLong.jpg', 'v1.4', 2, 3],
|
170 |
+
['10045.png', 'v1.4', 2, 0]], [file_path, version, rescaling_factor, blur_face])
|
171 |
+
gr.Markdown(article)
|
172 |
+
submit.click(
|
173 |
+
inference,
|
174 |
+
inputs=[file_path, version, rescaling_factor, blur_face],
|
175 |
+
outputs=[output_img, download, input_faces, output_faces]
|
176 |
+
)
|
177 |
demo.queue(concurrency_count=4)
|
178 |
demo.launch()
|