Update app.py
Browse files
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
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
demo = gr.Interface(
|
| 10 |
-
fn=
|
| 11 |
-
inputs=[gr.Image(type="pil"), gr.Image(type="pil")],
|
| 12 |
-
outputs=gr.Image(type="pil"),
|
| 13 |
-
|
|
|
|
|
|
|
| 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__":
|