Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -168,16 +168,102 @@ next_step = st.selectbox(
|
|
168 |
]
|
169 |
)
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
if next_step == "π¨ Explore design ideas (color palettes, materials for your climate)":
|
172 |
st.markdown("#### π¨ Design Recommendations")
|
173 |
-
st.
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
user_input = f"Region: {region}\n\nPrompt:\n{prompt}"
|
183 |
|
|
|
168 |
]
|
169 |
)
|
170 |
|
171 |
+
if next_step == st.markdown("#### π¨ Design Recommendations")
|
172 |
+
st.markdown("We'll give you some smart and stylish ideas for your project based on your region and layout.")
|
173 |
+
|
174 |
+
# Select region (re-use if already chosen earlier)
|
175 |
+
design_region = st.selectbox("Where will your home be built?", [
|
176 |
+
"British Columbia", "Alberta", "Ontario", "Quebec", "Atlantic Canada", "Prairies"
|
177 |
+
], key="design_region")
|
178 |
+
|
179 |
+
# Select design style
|
180 |
+
design_style = st.selectbox("What style do you like?", [
|
181 |
+
"Scandinavian", "Modern Minimalist", "Rustic Cabin", "Japandi", "West Coast Contemporary"
|
182 |
+
], key="design_style")
|
183 |
+
|
184 |
+
# Select categories
|
185 |
+
selected_categories = st.multiselect(
|
186 |
+
"What kind of design advice would you like?",
|
187 |
+
[
|
188 |
+
"Climate-Responsive Material Suggestions",
|
189 |
+
"Interior Color Palette",
|
190 |
+
"Lighting & Window Placement Tips",
|
191 |
+
"Space-Saving Built-ins"
|
192 |
+
],
|
193 |
+
default=["Climate-Responsive Material Suggestions", "Interior Color Palette"]
|
194 |
+
)
|
195 |
+
|
196 |
+
next_step = st.selectbox(
|
197 |
+
"Now that you have some information and a layout in mind, would you like help with...",
|
198 |
+
[
|
199 |
+
"Select an option",
|
200 |
+
"π¨ Explore design ideas (color palettes, materials for your climate)",
|
201 |
+
"π Continue researching (codes, build types, regulations)"
|
202 |
+
]
|
203 |
+
)
|
204 |
+
|
205 |
if next_step == "π¨ Explore design ideas (color palettes, materials for your climate)":
|
206 |
st.markdown("#### π¨ Design Recommendations")
|
207 |
+
st.markdown("We'll give you some smart and stylish ideas for your project based on your region and layout.")
|
208 |
+
|
209 |
+
# Select region
|
210 |
+
design_region = st.selectbox("Where will your home be built?", [
|
211 |
+
"British Columbia", "Alberta", "Ontario", "Quebec", "Atlantic Canada", "Prairies"
|
212 |
+
], key="design_region")
|
213 |
+
|
214 |
+
# Select design style
|
215 |
+
design_style = st.selectbox("What style do you like?", [
|
216 |
+
"Scandinavian", "Modern Minimalist", "Rustic Cabin", "Japandi", "West Coast Contemporary"
|
217 |
+
], key="design_style")
|
218 |
+
|
219 |
+
# Select categories
|
220 |
+
selected_categories = st.multiselect(
|
221 |
+
"What kind of design advice would you like?",
|
222 |
+
[
|
223 |
+
"Climate-Responsive Material Suggestions",
|
224 |
+
"Interior Color Palette",
|
225 |
+
"Lighting & Window Placement Tips",
|
226 |
+
"Space-Saving Built-ins"
|
227 |
+
],
|
228 |
+
default=["Climate-Responsive Material Suggestions", "Interior Color Palette"]
|
229 |
+
)
|
230 |
+
|
231 |
+
if st.button("Generate Design Ideas"):
|
232 |
+
with st.spinner("Designing your dream space..."):
|
233 |
+
def generate_design_ideas(prompt, region, style, categories):
|
234 |
+
system_instruction = (
|
235 |
+
"You are a residential design assistant. Based on the home description, region, and preferred design style, "
|
236 |
+
"give tailored recommendations for the selected categories. Keep it concise, stylish, and easy to implement for a small-scale home."
|
237 |
+
)
|
238 |
+
|
239 |
+
user_input = (
|
240 |
+
f"Prompt:\n{prompt}\n\n"
|
241 |
+
f"Region: {region}\n"
|
242 |
+
f"Style: {style}\n"
|
243 |
+
f"Categories: {', '.join(categories)}"
|
244 |
+
)
|
245 |
+
|
246 |
+
response = client.chat.completions.create(
|
247 |
+
model="gpt-4",
|
248 |
+
messages=[
|
249 |
+
{"role": "system", "content": system_instruction},
|
250 |
+
{"role": "user", "content": user_input}
|
251 |
+
],
|
252 |
+
temperature=0.7
|
253 |
+
)
|
254 |
+
return response.choices[0].message.content.strip()
|
255 |
+
|
256 |
+
design_results = generate_design_ideas(
|
257 |
+
st.session_state.prompt,
|
258 |
+
design_region,
|
259 |
+
design_style,
|
260 |
+
selected_categories
|
261 |
+
)
|
262 |
+
|
263 |
+
st.markdown("### π‘ Design Suggestions")
|
264 |
+
st.markdown(design_results)
|
265 |
+
|
266 |
+
|
267 |
|
268 |
user_input = f"Region: {region}\n\nPrompt:\n{prompt}"
|
269 |
|