Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -312,6 +312,54 @@ if st.button("Generate Concept Image from Design Summary"):
|
|
312 |
|
313 |
except Exception as e:
|
314 |
st.error(f"Image generation failed: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
|
316 |
|
317 |
|
|
|
312 |
|
313 |
except Exception as e:
|
314 |
st.error(f"Image generation failed: {e}")
|
315 |
+
|
316 |
+
if next_step == "π Continue researching (codes, build types, regulations)":
|
317 |
+
st.markdown("#### π Research Hub")
|
318 |
+
st.info("Here are some useful topics and tools to help you dig deeper before you build.")
|
319 |
+
|
320 |
+
st.markdown("##### π§ Suggested Topics to Explore")
|
321 |
+
research_topics = {
|
322 |
+
"Prefab vs. Traditional Construction": "Compare pros and cons of prefabricated (modular) vs. traditional stick-built homes.",
|
323 |
+
"Land Use & Zoning": "Understand how land use bylaws and zoning affect what and where you can build.",
|
324 |
+
"Permit & Code Requirements": "Find out what permits are typically needed for a small home project in Canada.",
|
325 |
+
"Sustainable Building Materials": "Explore environmentally-friendly materials that are affordable and effective.",
|
326 |
+
"Off-Grid Living Regulations": "Learn the legal considerations if you want to live off-grid.",
|
327 |
+
"Energy Efficiency Standards": "Understand how to meet or exceed Canadian energy code requirements."
|
328 |
+
}
|
329 |
+
|
330 |
+
selected_topic = st.selectbox("Choose a topic to learn more:", ["Select a topic"] + list(research_topics.keys()))
|
331 |
+
if selected_topic != "Select a topic":
|
332 |
+
with st.spinner("Researching..."):
|
333 |
+
response = client.chat.completions.create(
|
334 |
+
model="gpt-4",
|
335 |
+
messages=[
|
336 |
+
{"role": "system", "content": "You are a Canadian construction research assistant."},
|
337 |
+
{"role": "user", "content": research_topics[selected_topic]}
|
338 |
+
],
|
339 |
+
temperature=0.7
|
340 |
+
)
|
341 |
+
st.markdown(f"### π {selected_topic}")
|
342 |
+
st.markdown(response.choices[0].message.content.strip())
|
343 |
+
|
344 |
+
st.markdown("##### π¬ Ask Your Own Research Question")
|
345 |
+
user_question = st.text_input("What else would you like to learn about?")
|
346 |
+
if st.button("Ask"):
|
347 |
+
if user_question:
|
348 |
+
with st.spinner("Getting the answer..."):
|
349 |
+
response = client.chat.completions.create(
|
350 |
+
model="gpt-4",
|
351 |
+
messages=[
|
352 |
+
{"role": "system", "content": "You're a helpful Canadian homebuilding advisor. Keep answers clear and based on current standards."},
|
353 |
+
{"role": "user", "content": user_question}
|
354 |
+
],
|
355 |
+
temperature=0.7
|
356 |
+
)
|
357 |
+
st.markdown("### π‘ Answer")
|
358 |
+
st.markdown(response.choices[0].message.content.strip())
|
359 |
+
else:
|
360 |
+
st.warning("Please type a question first.")
|
361 |
+
|
362 |
+
|
363 |
|
364 |
|
365 |
|