Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -120,6 +120,9 @@ if st.button("Get Cost Estimate"):
|
|
120 |
st.warning("Please enter a prompt first.")
|
121 |
st.markdown("### ποΈ Building Code Comparison")
|
122 |
|
|
|
|
|
|
|
123 |
province_1 = st.selectbox("Select first province:", [
|
124 |
"British Columbia", "Alberta", "Ontario", "Quebec", "Atlantic Canada", "Prairies"
|
125 |
], key="prov1")
|
@@ -154,5 +157,74 @@ if st.button("Compare Building Codes"):
|
|
154 |
st.markdown(comparison)
|
155 |
else:
|
156 |
st.warning("Please select two different provinces.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
|
|
|
120 |
st.warning("Please enter a prompt first.")
|
121 |
st.markdown("### ποΈ Building Code Comparison")
|
122 |
|
123 |
+
st.markdown("---")
|
124 |
+
st.markdown("### π§Ύ Building Code Comparison Between Provinces")
|
125 |
+
|
126 |
province_1 = st.selectbox("Select first province:", [
|
127 |
"British Columbia", "Alberta", "Ontario", "Quebec", "Atlantic Canada", "Prairies"
|
128 |
], key="prov1")
|
|
|
157 |
st.markdown(comparison)
|
158 |
else:
|
159 |
st.warning("Please select two different provinces.")
|
160 |
+
st.markdown("### β‘οΈ What would you like to do next?")
|
161 |
+
|
162 |
+
next_step = st.selectbox(
|
163 |
+
"Now that you have some information and a layout in mind, would you like help with...",
|
164 |
+
[
|
165 |
+
"Select an option",
|
166 |
+
"π¨ Explore design ideas (color palettes, materials for your climate)",
|
167 |
+
"π Continue researching (codes, build types, regulations)"
|
168 |
+
]
|
169 |
+
)
|
170 |
+
|
171 |
+
if next_step == "π¨ Explore design ideas (color palettes, materials for your climate)":
|
172 |
+
st.markdown("#### π¨ Design Recommendations")
|
173 |
+
st.info("Based on your prompt and region, here are some interior and exterior design ideas:")
|
174 |
+
|
175 |
+
def suggest_designs(prompt, region):
|
176 |
+
system_instruction = (
|
177 |
+
"You are a residential design advisor. Based on the architectural prompt and region, "
|
178 |
+
"suggest color palettes, finish materials, and stylistic choices that suit the climate "
|
179 |
+
"and vibe of the home. Include interior and exterior ideas."
|
180 |
+
)
|
181 |
+
|
182 |
+
user_input = f"Region: {region}\n\nPrompt:\n{prompt}"
|
183 |
+
|
184 |
+
response = client.chat.completions.create(
|
185 |
+
model="gpt-4",
|
186 |
+
messages=[
|
187 |
+
{"role": "system", "content": system_instruction},
|
188 |
+
{"role": "user", "content": user_input}
|
189 |
+
],
|
190 |
+
temperature=0.7
|
191 |
+
)
|
192 |
+
|
193 |
+
return response.choices[0].message.content.strip()
|
194 |
+
|
195 |
+
design_suggestions = suggest_designs(st.session_state.prompt, region)
|
196 |
+
st.markdown(design_suggestions)
|
197 |
+
|
198 |
+
elif next_step == "π Continue researching (codes, build types, regulations)":
|
199 |
+
st.markdown("#### π Further Research Suggestions")
|
200 |
+
st.info("Here are some directions you can explore to better prepare your build:")
|
201 |
+
|
202 |
+
st.markdown("""
|
203 |
+
- π Compare prefab vs. traditional construction
|
204 |
+
- π± Explore sustainable and passive design principles
|
205 |
+
- π§Ύ Learn about zoning and land-use requirements in your area
|
206 |
+
- π οΈ Get familiar with permit processes and builder requirements
|
207 |
+
""")
|
208 |
+
|
209 |
+
if st.button("Ask a research question"):
|
210 |
+
research_q = st.text_input("What would you like to know more about?")
|
211 |
+
if research_q:
|
212 |
+
with st.spinner("Finding answers..."):
|
213 |
+
system_instruction = (
|
214 |
+
"You are a research assistant helping someone planning to build a modern home. "
|
215 |
+
"Answer their question in a clear, helpful way using Canadian context where possible."
|
216 |
+
)
|
217 |
+
|
218 |
+
response = client.chat.completions.create(
|
219 |
+
model="gpt-4",
|
220 |
+
messages=[
|
221 |
+
{"role": "system", "content": system_instruction},
|
222 |
+
{"role": "user", "content": research_q}
|
223 |
+
],
|
224 |
+
temperature=0.7
|
225 |
+
)
|
226 |
+
st.markdown(response.choices[0].message.content.strip())
|
227 |
+
|
228 |
+
|
229 |
|
230 |
|