ProgrammerParamesh/VirtualDress
0
1import gradio as gr2from run.run_ootd import run_ootd 3 4def gradio_interface(gpu_id, model_path, cloth_path, model_type, category, scale, step, sample, seed):5 image_paths = run_ootd(6 gpu_id=gpu_id,7 model_path=model_path,8 cloth_path=cloth_path,9 model_type=model_type,10 category=category,11 scale=scale,12 step=step,13 sample=sample,14 seed=seed15 )16 return [gr.Image.load(path) for path in image_paths]17 18# Define the Gradio interface19iface = gr.Interface(20 fn=gradio_interface,21 inputs=[22 gr.Number(label="GPU ID", default=0),23 gr.Textbox(label="Model Path"),24 gr.Textbox(label="Cloth Path"),25 gr.Radio(choices=["hd", "dc"], label="Model Type"),26 gr.Number(label="Category (0: upperbody, 1: lowerbody, 2: dress)", default=0),27 gr.Slider(minimum=1.0, maximum=5.0, step=0.1, label="Scale", default=2.0),28 gr.Number(label="Steps", default=20),29 gr.Number(label="Samples", default=4),30 gr.Number(label="Seed", default=-1)31 ],32 outputs=[gr.Image(label="Generated Images")],33 title="OOTD Gradio App",34 description="A Gradio app to run the OOTD model and generate images."35)36 37if __name__ == "__main__":38 iface.launch()39 