test / app.py
echoece's picture
Update app.py
2f0f763 verified
raw
history blame contribute delete
898 Bytes
import gradio as gr
from diffusers import DiffusionPipeline
import torch
import os
token = os.getenv("HF_TOKEN")
pipe = DiffusionPipeline.from_pretrained(
"Kotiko-ua/tryondiffusion-model",
use_auth_token=token # if the repo is gated
)
pipe = pipe.to("cuda" if torch.cuda.is_available() else "cpu")
def try_on(person_img, cloth_img):
# Minimal demo β€” replace with model-specific inference
prompt = f"A photo of this person wearing the clothes shown."
images = pipe(prompt, image=[person_img, cloth_img]).images
return images[0]
demo = gr.Interface(
fn=try_on,
inputs=[gr.Image(label="Person"), gr.Image(label="Clothing")],
outputs=gr.Image(label="Result"),
title="Virtual Try-On (TryOnDiffusion)",
description="Upload a full-body photo and a clothing item to see a virtual try-on result."
)
if __name__ == "__main__":
demo.launch()