File size: 898 Bytes
693f219
2f0f763
693f219
0888758
 
3e26252
 
2f0f763
 
 
3e26252
2f0f763
693f219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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()