File size: 512 Bytes
7698b47
45a7bb4
7698b47
6d1a1ab
 
 
45a7bb4
 
6d1a1ab
 
 
 
45a7bb4
6d1a1ab
 
 
 
 
 
 
 
 
 
 
45a7bb4
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
import gradio as gr
from huggingface_hub import InferenceClient

# 确保模型路径正确
model_name = "yisol/IDM-VTON"

# 初始化Inference Client
client = InferenceClient(model=model_name)

def image_to_image(img):
    try:
        # 调用模型进行推理
        result = client.image_to_image(inputs=img)
        return result
    except Exception as e:
        return f"Error: {e}"

iface = gr.Interface(
    fn=image_to_image,
    inputs="image",
    outputs="image",
    live=True
)

iface.launch()