Spaces:
Sleeping
Sleeping
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() | |