from src.rep_api import virtual_try_on import gradio as gr def create_virtualtryon_tab(): with gr.TabItem("Virtual Try-on",id="virtual_tryon"): with gr.Row(): with gr.Column(): human_img = gr.Image(label="Human Image") crop = gr.Checkbox(label="Crop", value=False) seed = gr.Number(label="Seed", value=42) steps = gr.Number(label="Steps", value=30) with gr.Column(): garm_img = gr.Image(label="Garment Image") category = gr.Dropdown(["upper_body", "lower_body", "full_body"], label="Category", value="upper_body") garment_des = gr.Textbox(label="Garment Description") with gr.Row(): tryon_btn = gr.Button("Try-on") with gr.Row(): tryon_out = gr.Image(label="Output", type="filepath") with gr.Row(): examples = gr.Examples( examples=[ [ False, 42, 30, "upper_body", "Test_images/pink_jumper.png", "Test_images/person_1.jpg","pink jumper"], [ True, 100, 50, "upper_body", "Test_images/Suit_2.png", "Test_images/person_2.jpg","Suit"], # [ False, 7, 20, "full_body", "path/to/garment_img3.jpg", "path/to/human_img3.jpg","Black Suit"] ], inputs=[ crop, seed, steps, category, garm_img,human_img, garment_des] ) tryon_btn.click(virtual_try_on, inputs=[crop, seed, steps, category, garm_img, human_img,garment_des],outputs=tryon_out)