Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
CHANGED
|
@@ -132,6 +132,8 @@ def analyze_home_photos(images, timeframe, additional_details, api_key):
|
|
| 132 |
# Enhanced system prompt for more specific and actionable recommendations
|
| 133 |
system_prompt = """You are an expert real estate advisor with deep knowledge of home selling strategies. You analyze home photos to provide EXTREMELY SPECIFIC, actionable recommendations that will maximize the property's selling price.
|
| 134 |
|
|
|
|
|
|
|
| 135 |
## FORMAT YOUR RESPONSE LIKE THIS:
|
| 136 |
|
| 137 |
### π KEY RECOMMENDATIONS SUMMARY
|
|
@@ -139,12 +141,15 @@ Begin with this exact text: "**HOME VALUE MAXIMIZER SUMMARY**"
|
|
| 139 |
|
| 140 |
Then add this line: "Below are the top improvements to maximize your home's value. See detailed sections for specific costs, instructions, and timeline."
|
| 141 |
|
| 142 |
-
Then, list 5 bullet points of the MOST IMPACTFUL improvements that will increase the property's value. For each bullet:
|
| 143 |
- Make the first sentence **bold**
|
| 144 |
- Include the specific issue identified
|
| 145 |
- Include the recommended solution
|
| 146 |
- Include the estimated value increase or ROI
|
| 147 |
|
|
|
|
|
|
|
|
|
|
| 148 |
### π TOP PRICE-MAXIMIZING PRIORITIES
|
| 149 |
Present the 3-4 MOST IMPACTFUL improvements first, formatted as a clear list. Each item MUST include:
|
| 150 |
- **Exact issue you see**: Be incredibly specific about what you observe in the photo (e.g., "The beige laminate countertops in the kitchen are visibly worn with scratches near the sink area")
|
|
@@ -154,11 +159,11 @@ Present the 3-4 MOST IMPACTFUL improvements first, formatted as a clear list. Ea
|
|
| 154 |
- **Timeline**: Exact number of days needed and mention if permits are required
|
| 155 |
|
| 156 |
### π¨ QUICK WINS (1-3 days)
|
| 157 |
-
List 5-6 fast, high-ROI improvements with EXACT details:
|
| 158 |
- **Kitchen**: Name specific issues, specific solutions, specific products/colors/materials
|
| 159 |
-
- **Bathroom**: Name specific issues, specific solutions, specific products/colors/materials
|
| 160 |
- **Living Spaces**: Name specific issues, specific solutions, specific products/colors/materials
|
| 161 |
-
- **
|
|
|
|
| 162 |
Include PRECISE cost estimates, DIY or contractor recommendations, and EXACT product suggestions.
|
| 163 |
|
| 164 |
### π SPECIFIC PRICING STRATEGY
|
|
@@ -194,18 +199,22 @@ Create a PRECISE calendar using EXACT DATES starting from TODAY (${current_date}
|
|
| 194 |
For example, if selling within 1-3 months:
|
| 195 |
- By [EXACT DATE]: Complete specific kitchen updates (list precisely what)
|
| 196 |
- By [EXACT DATE]: Finish specific bathroom improvements (list precisely what)
|
| 197 |
-
- By [EXACT DATE]: Address specific
|
| 198 |
- [EXACT DATE]: Schedule professional photography
|
| 199 |
- [EXACT DATE]: List the home on the market
|
| 200 |
|
|
|
|
|
|
|
|
|
|
| 201 |
## IMPORTANT GUIDELINES:
|
| 202 |
-
1.
|
| 203 |
-
2.
|
| 204 |
-
3.
|
| 205 |
-
4.
|
| 206 |
-
5.
|
| 207 |
-
6.
|
| 208 |
-
7.
|
|
|
|
| 209 |
"""
|
| 210 |
|
| 211 |
# Replace placeholders in the system prompt
|
|
@@ -584,16 +593,19 @@ with col1:
|
|
| 584 |
value="Mix of DIY and professional"
|
| 585 |
)
|
| 586 |
|
| 587 |
-
# Analysis button
|
| 588 |
analyze_button = st.button('π Analyze My Home',
|
| 589 |
use_container_width=True,
|
| 590 |
disabled=len(st.session_state["uploaded_images"]) == 0 or not st.session_state["api_key"])
|
| 591 |
|
|
|
|
|
|
|
|
|
|
| 592 |
if len(st.session_state["uploaded_images"]) == 0:
|
| 593 |
-
|
| 594 |
|
| 595 |
if not st.session_state["api_key"]:
|
| 596 |
-
st.warning("Please enter your OpenAI API key to enable analysis.")
|
| 597 |
|
| 598 |
with col2:
|
| 599 |
# Custom subheader with background
|
|
|
|
| 132 |
# Enhanced system prompt for more specific and actionable recommendations
|
| 133 |
system_prompt = """You are an expert real estate advisor with deep knowledge of home selling strategies. You analyze home photos to provide EXTREMELY SPECIFIC, actionable recommendations that will maximize the property's selling price.
|
| 134 |
|
| 135 |
+
## IMPORTANT: ONLY make recommendations based on what you can actually see in the photos. DO NOT make assumptions about areas not shown (like exterior if only interior is shown or vice versa).
|
| 136 |
+
|
| 137 |
## FORMAT YOUR RESPONSE LIKE THIS:
|
| 138 |
|
| 139 |
### π KEY RECOMMENDATIONS SUMMARY
|
|
|
|
| 141 |
|
| 142 |
Then add this line: "Below are the top improvements to maximize your home's value. See detailed sections for specific costs, instructions, and timeline."
|
| 143 |
|
| 144 |
+
Then, list 5 bullet points of the MOST IMPACTFUL improvements that will increase the property's value. ONLY include improvements for areas actually visible in the photos. For each bullet:
|
| 145 |
- Make the first sentence **bold**
|
| 146 |
- Include the specific issue identified
|
| 147 |
- Include the recommended solution
|
| 148 |
- Include the estimated value increase or ROI
|
| 149 |
|
| 150 |
+
### ποΈ AREAS ANALYZED
|
| 151 |
+
Clearly list which areas of the home you can see in the photos (e.g., "Kitchen, Living Room, Master Bathroom") and note that recommendations are based only on visible areas.
|
| 152 |
+
|
| 153 |
### π TOP PRICE-MAXIMIZING PRIORITIES
|
| 154 |
Present the 3-4 MOST IMPACTFUL improvements first, formatted as a clear list. Each item MUST include:
|
| 155 |
- **Exact issue you see**: Be incredibly specific about what you observe in the photo (e.g., "The beige laminate countertops in the kitchen are visibly worn with scratches near the sink area")
|
|
|
|
| 159 |
- **Timeline**: Exact number of days needed and mention if permits are required
|
| 160 |
|
| 161 |
### π¨ QUICK WINS (1-3 days)
|
| 162 |
+
List 5-6 fast, high-ROI improvements with EXACT details, BUT ONLY for areas visible in the photos:
|
| 163 |
- **Kitchen**: Name specific issues, specific solutions, specific products/colors/materials
|
|
|
|
| 164 |
- **Living Spaces**: Name specific issues, specific solutions, specific products/colors/materials
|
| 165 |
+
- **Bathroom**: Name specific issues, specific solutions, specific products/colors/materials
|
| 166 |
+
Only include categories that are actually visible in the photos.
|
| 167 |
Include PRECISE cost estimates, DIY or contractor recommendations, and EXACT product suggestions.
|
| 168 |
|
| 169 |
### π SPECIFIC PRICING STRATEGY
|
|
|
|
| 199 |
For example, if selling within 1-3 months:
|
| 200 |
- By [EXACT DATE]: Complete specific kitchen updates (list precisely what)
|
| 201 |
- By [EXACT DATE]: Finish specific bathroom improvements (list precisely what)
|
| 202 |
+
- By [EXACT DATE]: Address specific interior issues (list precisely what)
|
| 203 |
- [EXACT DATE]: Schedule professional photography
|
| 204 |
- [EXACT DATE]: List the home on the market
|
| 205 |
|
| 206 |
+
### π« AREAS NOT VISIBLE
|
| 207 |
+
If important areas for home selling evaluation (like exterior, bathrooms, bedrooms) are not shown in the photos, briefly mention: "Note: The following areas were not visible in the provided photos and could not be evaluated: [list areas]. Consider uploading photos of these areas for more comprehensive recommendations."
|
| 208 |
+
|
| 209 |
## IMPORTANT GUIDELINES:
|
| 210 |
+
1. ONLY make recommendations based on what you can ACTUALLY SEE in the photos. Never make recommendations for areas not shown.
|
| 211 |
+
2. Be EXTREMELY SPECIFIC about what you see in each photo - reference exact details, colors, materials
|
| 212 |
+
3. Give PRECISE product recommendations when possible - name brands, models, colors
|
| 213 |
+
4. Provide EXACT cost estimates in narrow ranges
|
| 214 |
+
5. Specify CLEAR timelines with CALENDAR DATES based on today's date (${current_date})
|
| 215 |
+
6. Make all advice HYPER-SPECIFIC to the actual property in the photos
|
| 216 |
+
7. NEVER give generic advice - every recommendation should directly reference visible elements
|
| 217 |
+
8. ALWAYS use proper spacing in text - add spaces between numbers and words, after punctuation, etc.
|
| 218 |
"""
|
| 219 |
|
| 220 |
# Replace placeholders in the system prompt
|
|
|
|
| 593 |
value="Mix of DIY and professional"
|
| 594 |
)
|
| 595 |
|
| 596 |
+
# Analysis button with improved error handling
|
| 597 |
analyze_button = st.button('π Analyze My Home',
|
| 598 |
use_container_width=True,
|
| 599 |
disabled=len(st.session_state["uploaded_images"]) == 0 or not st.session_state["api_key"])
|
| 600 |
|
| 601 |
+
# Clear image error message placement
|
| 602 |
+
image_error_placeholder = st.empty()
|
| 603 |
+
|
| 604 |
if len(st.session_state["uploaded_images"]) == 0:
|
| 605 |
+
image_error_placeholder.warning("β οΈ Please upload at least one valid photo of your home to receive recommendations.")
|
| 606 |
|
| 607 |
if not st.session_state["api_key"]:
|
| 608 |
+
st.warning("β οΈ Please enter your OpenAI API key to enable analysis.")
|
| 609 |
|
| 610 |
with col2:
|
| 611 |
# Custom subheader with background
|