Zongsheng commited on
Commit
f857ecf
β€’
1 Parent(s): 692826c

add alinged case

Browse files
Files changed (1) hide show
  1. app.py +60 -60
app.py CHANGED
@@ -24,7 +24,7 @@ from basicsr.utils.download_util import load_file_from_url
24
  cfg_path = 'configs/sample/iddpm_ffhq512_swinir.yaml'
25
  configs = OmegaConf.load(cfg_path)
26
  configs.aligned = False
27
- configs.diffusion.timestep_respacing = '200'
28
 
29
  # build the sampler for diffusion
30
  sampler_dist = DifIRSampler(configs)
@@ -92,62 +92,62 @@ def predict(im_path, background_enhance, face_upsample, upscale, started_timeste
92
 
93
  return image_restored, str(save_path)
94
 
95
- # title = "DifFace: Blind Face Restoration with Diffused Error Contraction"
96
- # description = r"""
97
- # <b>Official Gradio demo</b> for <a href='https://github.com/zsyOAOA/DifFace' target='_blank'><b>DifFace: Blind Face Restoration with Diffused Error Contraction</b></a>.<br>
98
- # πŸ”₯ DifFace is a robust face restoration algorithm for old or corrupted photos.<br>
99
- # """
100
- # article = r"""
101
- # If DifFace is helpful for your work, please help to ⭐ the <a href='https://github.com/zsyOAOA/DifFace' target='_blank'>Github Repo</a>. Thanks!
102
- # [![GitHub Stars](https://img.shields.io/github/stars/zsyOAOA/DifFace?affiliations=OWNER&color=green&style=social)](https://github.com/zsyOAOA/DifFace)
103
-
104
- # ---
105
-
106
- # πŸ“ **Citation**
107
-
108
- # If our work is useful for your research, please consider citing:
109
- # ```bibtex
110
- # @article{yue2022difface,
111
- # title={DifFace: Blind Face Restoration with Diffused Error Contraction},
112
- # author={Yue, Zongsheng and Loy, Chen Change},
113
- # journal={arXiv preprint arXiv:2212.06512},
114
- # year={2022}
115
- # }
116
- # ```
117
-
118
- # πŸ“‹ **License**
119
-
120
- # This project is licensed under <a rel="license" href="https://github.com/zsyOAOA/DifFace/blob/master/LICENSE">S-Lab License 1.0</a>.
121
- # Redistribution and use for non-commercial purposes should follow this license.
122
-
123
- # πŸ“§ **Contact**
124
- # If you have any questions, please feel free to contact me via <b>zsyzam@gmail.com</b>.
125
- # ![visitors](https://visitor-badge.laobi.icu/badge?page_id=zsyOAOA/DifFace)
126
- # """
127
-
128
- # demo = gr.Interface(
129
- # predict,
130
- # inputs=[
131
- # gr.Image(type="filepath", label="Input"),
132
- # gr.Checkbox(value=True, label="Background_Enhance"),
133
- # gr.Checkbox(value=True, label="Face_Upsample"),
134
- # gr.Number(value=2, label="Rescaling_Factor (up to 4)"),
135
- # gr.Slider(1, 160, value=80, step=10, label='Realism-Fidelity Trade-off')
136
- # ],
137
- # outputs=[
138
- # gr.Image(type="numpy", label="Output"),
139
- # gr.outputs.File(label="Download the output")
140
- # ],
141
- # title=title,
142
- # description=description,
143
- # article=article,
144
- # examples=[
145
- # ['./testdata/whole_imgs/00.jpg', True, True, 2, 80],
146
- # ['./testdata/whole_imgs/01.jpg', True, True, 2, 80],
147
- # ['./testdata/whole_imgs/04.jpg', True, True, 2, 80],
148
- # ['./testdata/whole_imgs/05.jpg', True, True, 2, 80],
149
- # ]
150
- # )
151
-
152
- # demo.queue(concurrency_count=4)
153
- # demo.launch()
24
  cfg_path = 'configs/sample/iddpm_ffhq512_swinir.yaml'
25
  configs = OmegaConf.load(cfg_path)
26
  configs.aligned = False
27
+ configs.diffusion.timestep_respacing = '250'
28
 
29
  # build the sampler for diffusion
30
  sampler_dist = DifIRSampler(configs)
92
 
93
  return image_restored, str(save_path)
94
 
95
+ title = "DifFace: Blind Face Restoration with Diffused Error Contraction"
96
+ description = r"""
97
+ <b>Official Gradio demo</b> for <a href='https://github.com/zsyOAOA/DifFace' target='_blank'><b>DifFace: Blind Face Restoration with Diffused Error Contraction</b></a>.<br>
98
+ πŸ”₯ DifFace is a robust face restoration algorithm for old or corrupted photos.<br>
99
+ """
100
+ article = r"""
101
+ If DifFace is helpful for your work, please help to ⭐ the <a href='https://github.com/zsyOAOA/DifFace' target='_blank'>Github Repo</a>. Thanks!
102
+ [![GitHub Stars](https://img.shields.io/github/stars/zsyOAOA/DifFace?affiliations=OWNER&color=green&style=social)](https://github.com/zsyOAOA/DifFace)
103
+
104
+ ---
105
+
106
+ πŸ“ **Citation**
107
+
108
+ If our work is useful for your research, please consider citing:
109
+ ```bibtex
110
+ @article{yue2022difface,
111
+ title={DifFace: Blind Face Restoration with Diffused Error Contraction},
112
+ author={Yue, Zongsheng and Loy, Chen Change},
113
+ journal={arXiv preprint arXiv:2212.06512},
114
+ year={2022}
115
+ }
116
+ ```
117
+
118
+ πŸ“‹ **License**
119
+
120
+ This project is licensed under <a rel="license" href="https://github.com/zsyOAOA/DifFace/blob/master/LICENSE">S-Lab License 1.0</a>.
121
+ Redistribution and use for non-commercial purposes should follow this license.
122
+
123
+ πŸ“§ **Contact**
124
+ If you have any questions, please feel free to contact me via <b>zsyzam@gmail.com</b>.
125
+ ![visitors](https://visitor-badge.laobi.icu/badge?page_id=zsyOAOA/DifFace)
126
+ """
127
+
128
+ demo = gr.Interface(
129
+ predict,
130
+ inputs=[
131
+ gr.Image(type="filepath", label="Input"),
132
+ gr.Checkbox(value=True, label="Background_Enhance"),
133
+ gr.Checkbox(value=True, label="Face_Upsample"),
134
+ gr.Number(value=2, label="Rescaling_Factor (up to 4)"),
135
+ gr.Slider(1, 160, value=100, step=10, label='Realism-Fidelity Trade-off')
136
+ ],
137
+ outputs=[
138
+ gr.Image(type="numpy", label="Output"),
139
+ gr.outputs.File(label="Download the output")
140
+ ],
141
+ title=title,
142
+ description=description,
143
+ article=article,
144
+ examples=[
145
+ ['./testdata/whole_imgs/00.jpg', True, True, 2, 100],
146
+ ['./testdata/whole_imgs/01.jpg', True, True, 2, 100],
147
+ ['./testdata/whole_imgs/04.jpg', True, True, 2, 100],
148
+ ['./testdata/whole_imgs/05.jpg', True, True, 2, 100],
149
+ ]
150
+ )
151
+
152
+ demo.queue(concurrency_count=4)
153
+ demo.launch()