curtain-try-on / app.py
dass777's picture
Create app.py
1cb4760 verified
# app.py
from gradio_client import Client
import gradio as gr
# Используем готовую модель для редактирования изображений
client = Client("nunchaku-tech/nunchaku-qwen-image-edit")
def add_curtains(image, style="classic", color="beige"):
prompt = f"Add {style} {color} curtains to the window in this photo, realistic, natural lighting, soft folds"
try:
result = client.predict(
image=image,
prompt=prompt,
api_name="/predict"
)
return result
except Exception as e:
return f"Ошибка: {e}"
demo = gr.Interface(
fn=add_curtains,
inputs=[
gr.Image(type="filepath", label="Фото вашего окна"),
gr.Radio(["classic", "modern", "roman", "austrian", "french"], value="classic", label="Стиль штор"),
gr.Textbox(value="beige", label="Цвет (например: beige, navy blue, white, gray)")
],
outputs=gr.Image(label="Результат"),
title="🪟 Виртуальная примерка штор",
description="Загрузите фото окна — ИИ добавит шторы в выбранном стиле!"
)
if __name__ == "__main__":
demo.launch()