nniehaus commited on
Commit
8fc331a
·
verified ·
1 Parent(s): 7e82a4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -16
app.py CHANGED
@@ -34,7 +34,7 @@ def encode_image(image):
34
  return base64.b64encode(buffered.getvalue()).decode('utf-8')
35
 
36
  # Function to analyze home photos with OpenAI's API
37
- def analyze_home_photos(images, property_type, price_range, timeframe, additional_details, api_key):
38
  if not api_key:
39
  return "Error: API Key is required for analysis."
40
 
@@ -45,7 +45,7 @@ def analyze_home_photos(images, property_type, price_range, timeframe, additiona
45
 
46
  # Construct the message content
47
  content = [
48
- {"type": "text", "text": f"""Analyze these home photos and recommend improvements to maximize value for a {property_type} in the {price_range} range.
49
  The owner plans to sell within {timeframe}. {additional_details}
50
 
51
  Be highly specific about what you see in the images and provide detailed analysis.
@@ -71,7 +71,13 @@ def analyze_home_photos(images, property_type, price_range, timeframe, additiona
71
  "role": "system",
72
  "content": """You are an expert real estate advisor and home improvement specialist who helps homeowners maximize their property value before selling. You analyze home photos and provide customized, detailed recommendations.
73
 
74
- Provide a comprehensive report organized as follows:
 
 
 
 
 
 
75
 
76
  1. QUICK WINS (1-3 days, low cost)
77
  For each recommendation include:
@@ -145,6 +151,18 @@ Always add the following text to the beginning of your response:
145
  # Main application
146
  st.title("Home Value Maximizer 🏡")
147
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  # Custom CSS for better appearance and readability
149
  st.markdown("""
150
  <style>
@@ -165,6 +183,14 @@ st.markdown("""
165
  background-color: #f8f9fa;
166
  }
167
 
 
 
 
 
 
 
 
 
168
  .quick-wins {
169
  border-left: 4px solid #28a745;
170
  }
@@ -197,6 +223,15 @@ st.markdown("""
197
  border-radius: 0.5rem;
198
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
199
  }
 
 
 
 
 
 
 
 
 
200
  </style>
201
  """, unsafe_allow_html=True)
202
 
@@ -234,20 +269,15 @@ with col1:
234
  with image_cols[i % min(3, len(images))]:
235
  st.image(img, width=150, caption=f"Image {i+1}")
236
 
237
- st.subheader("🏠 Property Details")
238
-
239
- property_type = st.selectbox("Property Type",
240
- ["Single Family Home", "Townhouse", "Condo/Apartment", "Multi-Family"])
241
-
242
- price_range = st.selectbox("Property Price Range",
243
- ["Entry-level", "Mid-range", "Luxury"])
244
 
245
- timeframe = st.radio("When do you plan to sell?",
246
- ["Less than 3 months", "3-6 months", "6+ months"])
 
247
 
248
  additional_details = st.text_area("Additional Details",
249
- placeholder="Describe specific areas you're considering renovating or any concerns.",
250
- height=80)
251
 
252
  # Additional preferences
253
  st.subheader("💰 Budget & Preferences")
@@ -291,8 +321,6 @@ with col2:
291
  with st.spinner("Analyzing your home and generating detailed recommendations..."):
292
  analysis_text = analyze_home_photos(
293
  st.session_state["uploaded_images"],
294
- property_type,
295
- price_range,
296
  timeframe,
297
  f"Budget: ${max_budget}. Focus areas: {', '.join(improvement_focus)}. DIY preference: {diy_preference}. {additional_details}",
298
  st.session_state["api_key"]
 
34
  return base64.b64encode(buffered.getvalue()).decode('utf-8')
35
 
36
  # Function to analyze home photos with OpenAI's API
37
+ def analyze_home_photos(images, timeframe, additional_details, api_key):
38
  if not api_key:
39
  return "Error: API Key is required for analysis."
40
 
 
45
 
46
  # Construct the message content
47
  content = [
48
+ {"type": "text", "text": f"""Analyze these home photos and recommend improvements to maximize the home's value before selling.
49
  The owner plans to sell within {timeframe}. {additional_details}
50
 
51
  Be highly specific about what you see in the images and provide detailed analysis.
 
71
  "role": "system",
72
  "content": """You are an expert real estate advisor and home improvement specialist who helps homeowners maximize their property value before selling. You analyze home photos and provide customized, detailed recommendations.
73
 
74
+ Begin your response with a "HIGH IMPACT PRIORITIES" section that highlights the 3-5 most impactful improvements the homeowner should focus on, based on:
75
+ 1. Visual impact
76
+ 2. Return on investment
77
+ 3. Selling timeline
78
+ 4. Budget considerations
79
+
80
+ After the high-impact priorities, provide a comprehensive report organized as follows:
81
 
82
  1. QUICK WINS (1-3 days, low cost)
83
  For each recommendation include:
 
151
  # Main application
152
  st.title("Home Value Maximizer 🏡")
153
 
154
+ # Description of how the tool works
155
+ st.markdown("""
156
+ ### How This Tool Works
157
+ 1. **Upload photos** of different areas of your home (exterior, kitchen, bathrooms, living areas, etc.)
158
+ 2. **Provide details** about your selling timeline and any specific concerns
159
+ 3. **Get personalized recommendations** on how to maximize your home's value before selling
160
+ 4. Our AI analyzes your photos and prioritizes improvements based on visual impact, cost, ROI, and your timeline
161
+
162
+ The tool will identify quick wins, weekend projects, and major improvements that could increase your home's value,
163
+ as well as potential renovations to avoid that wouldn't provide good return on investment.
164
+ """)
165
+
166
  # Custom CSS for better appearance and readability
167
  st.markdown("""
168
  <style>
 
183
  background-color: #f8f9fa;
184
  }
185
 
186
+ .high-impact {
187
+ border-left: 4px solid #17a2b8;
188
+ background-color: #e3f2fd;
189
+ padding: 1rem;
190
+ margin-bottom: 1.5rem;
191
+ border-radius: 0.5rem;
192
+ }
193
+
194
  .quick-wins {
195
  border-left: 4px solid #28a745;
196
  }
 
223
  border-radius: 0.5rem;
224
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
225
  }
226
+
227
+ /* Description box styling */
228
+ .description-box {
229
+ background-color: #f1f8ff;
230
+ padding: 1rem;
231
+ border-radius: 0.5rem;
232
+ margin-bottom: 1.5rem;
233
+ border-left: 4px solid #0366d6;
234
+ }
235
  </style>
236
  """, unsafe_allow_html=True)
237
 
 
269
  with image_cols[i % min(3, len(images))]:
270
  st.image(img, width=150, caption=f"Image {i+1}")
271
 
272
+ st.subheader("🏠 Selling Timeline & Details")
 
 
 
 
 
 
273
 
274
+ # Expanded selling timeline options
275
+ timeframe = st.radio("When do you plan to sell your home?",
276
+ ["Within 1 month", "1-3 months", "3-6 months", "6-12 months", "More than 12 months"])
277
 
278
  additional_details = st.text_area("Additional Details",
279
+ placeholder="Describe specific areas you're considering renovating, concerns, or any particular goals you have for selling your home.",
280
+ height=100)
281
 
282
  # Additional preferences
283
  st.subheader("💰 Budget & Preferences")
 
321
  with st.spinner("Analyzing your home and generating detailed recommendations..."):
322
  analysis_text = analyze_home_photos(
323
  st.session_state["uploaded_images"],
 
 
324
  timeframe,
325
  f"Budget: ${max_budget}. Focus areas: {', '.join(improvement_focus)}. DIY preference: {diy_preference}. {additional_details}",
326
  st.session_state["api_key"]