Spaces:
Sleeping
Sleeping
Create ui.py
Browse files
ui.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from PIL import Image
|
3 |
+
|
4 |
+
def build_ui(try_on_fn, styles):
|
5 |
+
with gr.Blocks(title="Salon Hairstyle Virtual Try-On") as demo:
|
6 |
+
gr.Markdown("## 💇♀️ Salon Hairstyle Virtual Try-On")
|
7 |
+
with gr.Row():
|
8 |
+
with gr.Column():
|
9 |
+
inp = gr.Image(type="numpy", label="Upload or capture", sources=["upload", "webcam"])
|
10 |
+
style = gr.Dropdown(choices=styles, label="Choose a hairstyle", interactive=True)
|
11 |
+
btn = gr.Button("Try On")
|
12 |
+
with gr.Column():
|
13 |
+
out = gr.Image(type="numpy", label="Result", interactive=False)
|
14 |
+
btn.click(fn=try_on_fn, inputs=[inp, style], outputs=out)
|
15 |
+
return demo
|