saloon / ui.py
Sanjayraju30's picture
Create ui.py
96dad42 verified
raw
history blame contribute delete
702 Bytes
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