Spaces:
Build error
Build error
Create ui.py
Browse files
ui.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def create_interface(apply_fn, hairstyles):
|
| 4 |
+
with gr.Blocks() as demo:
|
| 5 |
+
gr.Markdown("## π Salon Virtual Hairstyle Try-On (Face-Aligned, No Manual Adjustment Needed)")
|
| 6 |
+
with gr.Row():
|
| 7 |
+
with gr.Column():
|
| 8 |
+
img_input = gr.Image(type="pil", label="π€ Upload Your Image")
|
| 9 |
+
style_choice = gr.Slider(0, max(len(hairstyles)-1, 0), step=1, label="π¨ Select Hairstyle")
|
| 10 |
+
apply_btn = gr.Button("β¨ Apply Hairstyle")
|
| 11 |
+
with gr.Column():
|
| 12 |
+
img_output = gr.Image(label="π Result Preview")
|
| 13 |
+
|
| 14 |
+
apply_btn.click(
|
| 15 |
+
fn=apply_fn,
|
| 16 |
+
inputs=[img_input, style_choice],
|
| 17 |
+
outputs=img_output
|
| 18 |
+
)
|
| 19 |
+
return demo
|