Update app.py
Browse files
app.py
CHANGED
@@ -93,15 +93,19 @@ def get_demo():
|
|
93 |
gr.Markdown("## HairFastGan")
|
94 |
gr.Markdown(
|
95 |
'<div style="display: flex; align-items: center; gap: 10px;">'
|
96 |
-
'<span>
|
|
|
|
|
|
|
|
|
97 |
'</div>'
|
98 |
)
|
99 |
with gr.Row():
|
100 |
with gr.Column():
|
101 |
-
source = gr.Image(label="
|
102 |
with gr.Row():
|
103 |
-
shape = gr.Image(label="
|
104 |
-
color = gr.Image(label="
|
105 |
with gr.Accordion("Advanced Options", open=False):
|
106 |
blending = gr.Radio(["Article", "Alternative_v1", "Alternative_v2"], value='Article',
|
107 |
label="Color Encoder version", info="Selects a model for hair color transfer.")
|
@@ -128,7 +132,15 @@ def get_demo():
|
|
128 |
btn.click(fn=swap_hair, inputs=[source, shape, color, blending, poisson_iters, poisson_erosion],
|
129 |
outputs=[output, error_message])
|
130 |
|
131 |
-
gr.Markdown('''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
''')
|
133 |
return demo
|
134 |
|
@@ -136,4 +148,4 @@ def get_demo():
|
|
136 |
if __name__ == '__main__':
|
137 |
align_cache = LRUCache(maxsize=10)
|
138 |
demo = get_demo()
|
139 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
93 |
gr.Markdown("## HairFastGan")
|
94 |
gr.Markdown(
|
95 |
'<div style="display: flex; align-items: center; gap: 10px;">'
|
96 |
+
'<span>Official HairFastGAN Gradio demo:</span>'
|
97 |
+
'<a href="https://arxiv.org/abs/2404.01094"><img src="https://img.shields.io/badge/arXiv-2404.01094-b31b1b.svg" height=22.5></a>'
|
98 |
+
'<a href="https://github.com/AIRI-Institute/HairFastGAN"><img src="https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white" height=22.5></a>'
|
99 |
+
'<a href="https://huggingface.co/AIRI-Institute/HairFastGAN"><img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/model-on-hf-md.svg" height=22.5></a>'
|
100 |
+
'<a href="https://colab.research.google.com/#fileId=https://huggingface.co/AIRI-Institute/HairFastGAN/blob/main/notebooks/HairFast_inference.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" height=22.5></a>'
|
101 |
'</div>'
|
102 |
)
|
103 |
with gr.Row():
|
104 |
with gr.Column():
|
105 |
+
source = gr.Image(label="Source photo to try on the hairstyle", type="pil")
|
106 |
with gr.Row():
|
107 |
+
shape = gr.Image(label="Shape photo with desired hairstyle (optional)", type="pil")
|
108 |
+
color = gr.Image(label="Color photo with desired hair color (optional)", type="pil")
|
109 |
with gr.Accordion("Advanced Options", open=False):
|
110 |
blending = gr.Radio(["Article", "Alternative_v1", "Alternative_v2"], value='Article',
|
111 |
label="Color Encoder version", info="Selects a model for hair color transfer.")
|
|
|
132 |
btn.click(fn=swap_hair, inputs=[source, shape, color, blending, poisson_iters, poisson_erosion],
|
133 |
outputs=[output, error_message])
|
134 |
|
135 |
+
gr.Markdown('''To cite the paper by the authors
|
136 |
+
```
|
137 |
+
@article{nikolaev2024hairfastgan,
|
138 |
+
title={HairFastGAN: Realistic and Robust Hair Transfer with a Fast Encoder-Based Approach},
|
139 |
+
author={Nikolaev, Maxim and Kuznetsov, Mikhail and Vetrov, Dmitry and Alanov, Aibek},
|
140 |
+
journal={arXiv preprint arXiv:2404.01094},
|
141 |
+
year={2024}
|
142 |
+
}
|
143 |
+
```
|
144 |
''')
|
145 |
return demo
|
146 |
|
|
|
148 |
if __name__ == '__main__':
|
149 |
align_cache = LRUCache(maxsize=10)
|
150 |
demo = get_demo()
|
151 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|