File size: 1,270 Bytes
1cb4760
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
# 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()