Spaces:
Running
Running
import gradio as gr | |
from PIL import Image | |
def build_ui(try_on_fn, styles): | |
with gr.Blocks(title="Salon Hairstyle Virtual Try-On") as demo: | |
gr.Markdown("## πββοΈ Salon Hairstyle Virtual Try-On") | |
with gr.Row(): | |
with gr.Column(): | |
inp = gr.Image(type="numpy", label="Upload or capture", sources=["upload", "webcam"]) | |
style = gr.Dropdown(choices=styles, label="Choose a hairstyle", interactive=True) | |
btn = gr.Button("Try On") | |
with gr.Column(): | |
out = gr.Image(type="numpy", label="Result", interactive=False) | |
btn.click(fn=try_on_fn, inputs=[inp, style], outputs=out) | |
return demo | |