dass777 commited on
Commit
1cb4760
·
verified ·
1 Parent(s): 5e95328

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ from gradio_client import Client
3
+ import gradio as gr
4
+
5
+ # Используем готовую модель для редактирования изображений
6
+ client = Client("nunchaku-tech/nunchaku-qwen-image-edit")
7
+
8
+ def add_curtains(image, style="classic", color="beige"):
9
+ prompt = f"Add {style} {color} curtains to the window in this photo, realistic, natural lighting, soft folds"
10
+ try:
11
+ result = client.predict(
12
+ image=image,
13
+ prompt=prompt,
14
+ api_name="/predict"
15
+ )
16
+ return result
17
+ except Exception as e:
18
+ return f"Ошибка: {e}"
19
+
20
+ demo = gr.Interface(
21
+ fn=add_curtains,
22
+ inputs=[
23
+ gr.Image(type="filepath", label="Фото вашего окна"),
24
+ gr.Radio(["classic", "modern", "roman", "austrian", "french"], value="classic", label="Стиль штор"),
25
+ gr.Textbox(value="beige", label="Цвет (например: beige, navy blue, white, gray)")
26
+ ],
27
+ outputs=gr.Image(label="Результат"),
28
+ title="🪟 Виртуальная примерка штор",
29
+ description="Загрузите фото окна — ИИ добавит шторы в выбранном стиле!"
30
+ )
31
+
32
+ if __name__ == "__main__":
33
+ demo.launch()