Spaces:
Running
Running
Commit
ยท
3a51976
1
Parent(s):
00a7c3e
update
Browse files- README.md +1 -1
- app.py +8 -10
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: GFPGAN
|
| 3 |
emoji: ๐
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: green
|
|
|
|
| 1 |
---
|
| 2 |
+
title: GFPGAN-ZEROGPU
|
| 3 |
emoji: ๐
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: green
|
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import torch
|
|
| 6 |
from basicsr.archs.srvgg_arch import SRVGGNetCompact
|
| 7 |
from gfpgan.utils import GFPGANer
|
| 8 |
from realesrgan.utils import RealESRGANer
|
|
|
|
| 9 |
|
| 10 |
os.system("pip freeze")
|
| 11 |
# download weights
|
|
@@ -45,6 +46,7 @@ os.makedirs('output', exist_ok=True)
|
|
| 45 |
|
| 46 |
|
| 47 |
# def inference(img, version, scale, weight):
|
|
|
|
| 48 |
def inference(img, version, scale):
|
| 49 |
# weight /= 100
|
| 50 |
print(img, version, scale)
|
|
@@ -113,21 +115,17 @@ def inference(img, version, scale):
|
|
| 113 |
|
| 114 |
|
| 115 |
title = "GFPGAN: Practical Face Restoration Algorithm"
|
| 116 |
-
description = r"""
|
| 117 |
It can be used to restore your **old photos** or improve **AI-generated faces**.<br>
|
| 118 |
To use it, simply upload your image.<br>
|
| 119 |
-
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 ๐
|
| 120 |
"""
|
| 121 |
article = r"""
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
[
|
| 124 |
-
[](https://github.com/TencentARC/GFPGAN)
|
| 125 |
-
[](https://arxiv.org/abs/2101.04061)
|
| 126 |
|
| 127 |
-
If you have any question, please email ๐ง `[email protected]` or `[email protected]`.
|
| 128 |
-
|
| 129 |
-
<center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_GFPGAN' alt='visitor badge'></center>
|
| 130 |
-
<center><img src='https://visitor-badge.glitch.me/badge?page_id=Gradio_Xintao_GFPGAN' alt='visitor badge'></center>
|
| 131 |
"""
|
| 132 |
demo = gr.Interface(
|
| 133 |
inference, [
|
|
@@ -147,4 +145,4 @@ demo = gr.Interface(
|
|
| 147 |
# ['10045.png', 'v1.4', 2, 50]]).launch()
|
| 148 |
examples=[['AI-generate.jpg', 'v1.4', 2], ['lincoln.jpg', 'v1.4', 2], ['Blake_Lively.jpg', 'v1.4', 2],
|
| 149 |
['10045.png', 'v1.4', 2]])
|
| 150 |
-
demo.queue().launch()
|
|
|
|
| 6 |
from basicsr.archs.srvgg_arch import SRVGGNetCompact
|
| 7 |
from gfpgan.utils import GFPGANer
|
| 8 |
from realesrgan.utils import RealESRGANer
|
| 9 |
+
import spaces
|
| 10 |
|
| 11 |
os.system("pip freeze")
|
| 12 |
# download weights
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
# def inference(img, version, scale, weight):
|
| 49 |
+
@spaces.GPU(enable_queue=True)
|
| 50 |
def inference(img, version, scale):
|
| 51 |
# weight /= 100
|
| 52 |
print(img, version, scale)
|
|
|
|
| 115 |
|
| 116 |
|
| 117 |
title = "GFPGAN: Practical Face Restoration Algorithm"
|
| 118 |
+
description = r"""GFPGAN On ZeroGPU : Towards Real-World Blind Face Restoration with Generative Facial Prior</b></a>.<br>
|
| 119 |
It can be used to restore your **old photos** or improve **AI-generated faces**.<br>
|
| 120 |
To use it, simply upload your image.<br>
|
|
|
|
| 121 |
"""
|
| 122 |
article = r"""
|
| 123 |
+
This is a clone of the original <a href='https://huggingface.co/spaces/Xintao/GFPGAN' target='_blank'>GFPGAN demo</a> with the following changes:
|
| 124 |
+
- The original demo was modified to use the GPU for inference.
|
| 125 |
+
- changed touch version to v2.0.0
|
| 126 |
|
| 127 |
+
Please follow me on [Linkedin](https://www.linkedin.com/in/saifturzo3/).
|
|
|
|
|
|
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
"""
|
| 130 |
demo = gr.Interface(
|
| 131 |
inference, [
|
|
|
|
| 145 |
# ['10045.png', 'v1.4', 2, 50]]).launch()
|
| 146 |
examples=[['AI-generate.jpg', 'v1.4', 2], ['lincoln.jpg', 'v1.4', 2], ['Blake_Lively.jpg', 'v1.4', 2],
|
| 147 |
['10045.png', 'v1.4', 2]])
|
| 148 |
+
demo.queue(max_size=50).launch()
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
torch
|
| 2 |
basicsr>=1.4.2
|
| 3 |
facexlib>=0.2.5
|
| 4 |
gfpgan>=1.3.7
|
|
|
|
| 1 |
+
torch==2.0.0
|
| 2 |
basicsr>=1.4.2
|
| 3 |
facexlib>=0.2.5
|
| 4 |
gfpgan>=1.3.7
|