Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,19 +4,32 @@ import numpy as np
|
|
4 |
|
5 |
f = modal.Cls.lookup("casa-interior-hf-v3", "DesignModel")
|
6 |
|
7 |
-
def casa_ai_run_tab1(image=None, room_type=None, interior_style=None, objects=None):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
if image is None:
|
10 |
print('Please provide image of empty room to design')
|
11 |
return None
|
12 |
|
13 |
-
if
|
14 |
-
print('Please
|
15 |
return None
|
16 |
|
17 |
-
objects_str = ", ".join(objects)
|
18 |
-
text = f"A {room_type} in style of {interior_style} with {objects_str}."
|
19 |
-
|
20 |
result_image = f.inference.remote("tab1", image, text)
|
21 |
return result_image
|
22 |
|
@@ -59,21 +72,22 @@ with gr.Blocks() as casa:
|
|
59 |
with gr.Column():
|
60 |
inputs = [
|
61 |
gr.Image(sources='upload', type="pil", label="Upload"),
|
62 |
-
gr.
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
77 |
]
|
78 |
with gr.Column():
|
79 |
outputs = [gr.Image(label="Generated room image")]
|
|
|
4 |
|
5 |
f = modal.Cls.lookup("casa-interior-hf-v3", "DesignModel")
|
6 |
|
7 |
+
# def casa_ai_run_tab1(image=None, room_type=None, interior_style=None, objects=None):
|
8 |
+
|
9 |
+
# if image is None:
|
10 |
+
# print('Please provide image of empty room to design')
|
11 |
+
# return None
|
12 |
+
|
13 |
+
# if (room_type is None or interior_style is None or objects is None):
|
14 |
+
# print('Please select all three (Room type, Interior Style and Objects')
|
15 |
+
# return None
|
16 |
+
|
17 |
+
# objects_str = ", ".join(objects)
|
18 |
+
# text = f"A {room_type} in style of {interior_style} with {objects_str}."
|
19 |
+
|
20 |
+
# result_image = f.inference.remote("tab1", image, text)
|
21 |
+
# return result_image
|
22 |
+
|
23 |
+
def casa_ai_run_tab1(image=None, text=None):
|
24 |
|
25 |
if image is None:
|
26 |
print('Please provide image of empty room to design')
|
27 |
return None
|
28 |
|
29 |
+
if text is None:
|
30 |
+
print('Please provide a text prompt')
|
31 |
return None
|
32 |
|
|
|
|
|
|
|
33 |
result_image = f.inference.remote("tab1", image, text)
|
34 |
return result_image
|
35 |
|
|
|
72 |
with gr.Column():
|
73 |
inputs = [
|
74 |
gr.Image(sources='upload', type="pil", label="Upload"),
|
75 |
+
gr.Textbox(label="Prompt for redesigning masked object")]
|
76 |
+
# gr.Dropdown(
|
77 |
+
# label="Room type",
|
78 |
+
# choices=["Living Room", "Bedroom", "Home Office", "Dining Room", "Kitchen", "Bathroom"],
|
79 |
+
# multiselect=False
|
80 |
+
# ),
|
81 |
+
# gr.Dropdown(
|
82 |
+
# label="Interior Style",
|
83 |
+
# choices=["Modern", "Traditional", "Contemporary", "Minimalist", "Rustic", "Industrial", "Scandinavian"],
|
84 |
+
# multiselect=False
|
85 |
+
# ),
|
86 |
+
# gr.Dropdown(
|
87 |
+
# label="Objects",
|
88 |
+
# choices=["Sofa", "Bed", "Table", "Chair", "Fridge", "Dinning table", "Coffee table"],
|
89 |
+
# multiselect=True
|
90 |
+
# ),
|
91 |
]
|
92 |
with gr.Column():
|
93 |
outputs = [gr.Image(label="Generated room image")]
|