feylur commited on
Commit
e12eb26
·
verified ·
1 Parent(s): 30a97ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -1,16 +1,19 @@
1
  import gradio as gr
2
- from inference_module.run_inference import predict
3
  from PIL import Image
 
4
 
5
- def infer(person, cloth):
6
- out_path = predict(person, cloth)
7
- return Image.open(out_path)
 
8
 
9
  demo = gr.Interface(
10
- fn=infer,
11
- inputs=[gr.Image(type="pil"), gr.Image(type="pil")],
12
- outputs=gr.Image(type="pil"),
13
- description="CatVTON demo — upload person + cloth"
 
 
14
  )
15
 
16
  if __name__ == "__main__":
 
1
  import gradio as gr
 
2
  from PIL import Image
3
+ from inference import get_pipeline
4
 
5
+ def tryon(person_img, cloth_img):
6
+ pipeline = get_pipeline()
7
+ result, meta = pipeline.run_inference(person_img, cloth_img, num_steps=25)
8
+ return result, f"Seed: {meta['seed']} | Time: {meta['timings']['total_ms']} ms"
9
 
10
  demo = gr.Interface(
11
+ fn=tryon,
12
+ inputs=[gr.Image(type="pil", label="Person"), gr.Image(type="pil", label="Garment")],
13
+ outputs=[gr.Image(type="pil", label="Result"), gr.Textbox(label="Metadata")],
14
+ title="CatVTON Virtual Try-On",
15
+ description="Upload a person image and a garment image to visualize the CatVTON try-on result.",
16
+ allow_flagging="never",
17
  )
18
 
19
  if __name__ == "__main__":