Spaces:
Runtime error
Runtime error
Commit
•
7a82ab9
1
Parent(s):
033cd3f
Update app.py
Browse files
app.py
CHANGED
@@ -55,16 +55,31 @@ def swap_hair(source, target_1, target_2, progress=gr.Progress(track_tqdm=True))
|
|
55 |
|
56 |
with gr.Blocks() as demo:
|
57 |
gr.Markdown("## HairFastGan")
|
|
|
58 |
with gr.Row():
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
gr.Examples(examples=[["michael_cera-min.png", "leo_square-min.png", "pink_hair_celeb-min.png"]], inputs=[source, target_1, target_2], outputs=output)
|
65 |
source.upload(fn=resize, inputs=source, outputs=source)
|
66 |
target_1.upload(fn=resize, inputs=target_1, outputs=target_1)
|
67 |
target_2.upload(fn=resize, inputs=target_2, outputs=target_2)
|
68 |
btn.click(fn=swap_hair, inputs=[source, target_1, target_2], outputs=[output])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
demo.launch()
|
|
|
55 |
|
56 |
with gr.Blocks() as demo:
|
57 |
gr.Markdown("## HairFastGan")
|
58 |
+
gr.Markdown("Gradio demo for [AIRI Institute](https://github.com/AIRI-Institute)'s HairFastGan: [Paper](https://huggingface.co/papers/2404.01094) | [GitHub](https://github.com/AIRI-Institute/HairFastGAN) | [Weights 🤗](https://huggingface.co/AIRI-Institute/HairFastGAN) | [Colab](https://colab.research.google.com/#fileId=https%3A//huggingface.co/AIRI-Institute/HairFastGAN/blob/main/notebooks/HairFast_inference.ipynb)")
|
59 |
with gr.Row():
|
60 |
+
with gr.Column():
|
61 |
+
with gr.Row():
|
62 |
+
source = gr.Image(label="Photo that you want to replace the hair", type="filepath")
|
63 |
+
target_1 = gr.Image(label="Reference hair you want to get", type="filepath")
|
64 |
+
with gr.Accordion("Reference hair color", open=False):
|
65 |
+
target_2 = gr.Image(label="Reference color hair you want to get (optional)", type="filepath")
|
66 |
+
btn = gr.Button("Get the haircut")
|
67 |
+
with gr.Column():
|
68 |
+
output = gr.Image(label="Your result")
|
69 |
gr.Examples(examples=[["michael_cera-min.png", "leo_square-min.png", "pink_hair_celeb-min.png"]], inputs=[source, target_1, target_2], outputs=output)
|
70 |
source.upload(fn=resize, inputs=source, outputs=source)
|
71 |
target_1.upload(fn=resize, inputs=target_1, outputs=target_1)
|
72 |
target_2.upload(fn=resize, inputs=target_2, outputs=target_2)
|
73 |
btn.click(fn=swap_hair, inputs=[source, target_1, target_2], outputs=[output])
|
74 |
+
gr.Markdown('''To cite the paper by the authors
|
75 |
+
```
|
76 |
+
@article{nikolaev2024hairfastgan,
|
77 |
+
title={HairFastGAN: Realistic and Robust Hair Transfer with a Fast Encoder-Based Approach},
|
78 |
+
author={Nikolaev, Maxim and Kuznetsov, Mikhail and Vetrov, Dmitry and Alanov, Aibek},
|
79 |
+
journal={arXiv preprint arXiv:2404.01094},
|
80 |
+
year={2024}
|
81 |
+
}
|
82 |
+
```
|
83 |
+
''')
|
84 |
|
85 |
demo.launch()
|