nniehaus commited on
Commit
136ee63
1 Parent(s): 124e810

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -145
app.py CHANGED
@@ -1,152 +1,33 @@
1
  import streamlit as st
2
- import openai
3
 
4
- # Access the OpenAI API key from Hugging Face Spaces secrets
5
- openai.api_key = st.secrets["YOUR_OPENAI_API_KEY"]
 
 
 
 
6
 
7
- st.title("Investment Property Finder in Breckenridge and Blue River, CO")
 
 
 
 
 
 
8
 
9
- # User inputs
10
- max_price = st.text_input("Maximum Price")
11
- amenities = st.multiselect("Amenities", ["Close to Skiing", "Hot Tub", "Bus Route", "Parking"])
12
- bedrooms = st.selectbox("Bedrooms", ["1", "2", "3", "4", "5+"])
13
- bathrooms = st.selectbox("Bathrooms", ["1", "2", "3", "4", "5+"])
14
- square_footage = st.selectbox("Square Footage", ["<1000 sqft", "1000-2000 sqft", "2000-3000 sqft", "3000-4000 sqft", "4000+ sqft"])
15
 
16
- if st.button('Find Property'):
17
- # Process the inputs and call the OpenAI API
18
- user_input = (
19
- """You are an AI assistant that provides highly specific investment property recommendations in Breckenridge and
20
- Blue River, CO. Consider the user's maximum price, selected amenities, and area preferences to recommend specific neighborhoods
21
- or intersections that would be a good fit for investment. Importantly, only recommend areas where short-term rentals are allowed
22
- under the new law. I'm considering buying an investment property in Breckenridge and Blue River, CO. My maximum price is {max_price}. I'm
23
- looking for these amenities: {', '.join(amenities)}. Bedrooms: {bedrooms}, Bathrooms: {bathrooms}, Square Footage: {square_footage}.
24
- Only reply with neighborhoods from this list of approved neighborhoods:
25
- Boulder Ridge Sub
26
- Peak 8 Place
27
- Glenwild sub
28
- Twin Elk Lodge
29
- Saw Mill Patch Townhomes
30
- Sawmill Creek Village
31
- Breckenridge Park Meadows Condo
32
- Wildwood Lodge Condo
33
- Sunset Condo
34
- Double Eagle Condo
35
- Four O’Clock Condo
36
- Tyra Summit Condo #3 Mountaineer
37
- Wedgewood Condo
38
- Retreat Condo
39
- Winterpoint Townhomes
40
- Antlers Lodge Condominiums
41
- Skyway Lodge Condo
42
- Jenni Exchange Condo
43
- Snider Addition
44
- Bartlett & Shock Sub
45
- Journal Building Condo
46
- Ski Hill Condo
47
- Georgia Square Condo
48
- River Mountain Lodge Condo
49
- Sawmill Creek Condo
50
- Sawmill Creek Village Sub
51
- Pine Ridge Condo
52
- Blazing Saddles Condo
53
- Main Street Mall Condo
54
- Park Place Condo
55
- Sundowner II Condos
56
- Sundowner Condo
57
- Cimarron Condo
58
- One Breckenridge Place
59
- Columbine Condo
60
- Winterpoint Townhomes
61
- Trails End Condo
62
- Cedars At Breckenridge Townhomes
63
- Der Steiermark Condo
64
- Mountainwood Condo
65
- Park Avenue Lofts Condo
66
- Snodallion Condo
67
- Timbernest Condo
68
- Powderhorn Condo
69
- Pine Creek Townhomes
70
- Tannenbaum By The River
71
- Mother Lode Condo
72
- Base 9 Condo
73
- Snowdrop Condo
74
- Lance’s West Condo
75
- Miners Candle Condo
76
- Lift Condo
77
- Snowspruce Condo
78
- Inner Circle Condo
79
- Christiana Condo
80
- Tamarisk Condo
81
- Village Point Townhomes At Breck
82
- Corral At Breckenridge
83
- Snowflake
84
- Chimney Ridge Townhomes
85
- Highlander Townhomes
86
- Elk Ridge Townhomes
87
- Kings Ridge Condo
88
- Los Pinos
89
- Westridge Townhomes
90
- Westridge Cluster Homes
91
- Tyra IV Riverbend Lodge Condo
92
- Saddlewood condo
93
- Timber Trail Sub
94
- Tyra Summit Condo
95
- Crystal Peak Lodge
96
- One Ski Hill Place
97
- Mountain Thunder Lodge
98
- River Mountain Lodge Condo
99
- Main Street Junction
100
- Main Street Station Condo
101
- Water House on Main Breck
102
- Village At Breckenridge
103
- Plaza Three Condo AKA Wetterhorn
104
- Liftside Condo
105
- Chateaux Condominium Hotel
106
- Marriot Mountain Valley Lodge AKA Hotel Breckenridge
107
- Beaver Run Condo
108
- Bluesky Breckenridge Condo
109
 
110
- 96 Subdivision
111
- 97 South Subdivision
112
- 97 Subdivision
113
- Aspen View
114
- Blue Rock Springs
115
- Bryce Estates
116
- Clyde Lode
117
- Coronet
118
- Crown
119
- Blue River Condos
120
- Golden Crown
121
- Lakeshore
122
- Leap Year
123
- Louise Placer
124
- McCullough Gulch
125
- Mountain View
126
- New Eldorado
127
- New Eldorado Townhomes
128
- Pennsylvania Canyon
129
- Rivershore
130
- Royal
131
- Sherwood Forest
132
- Silverheels
133
- Smith Mining Claim
134
- Spillway
135
- Sunny Slope
136
- Timber Creek Estates
137
- Timber Line
138
- Wilderness
139
- """
140
- )
141
-
142
- # Call the OpenAI API with the chat model
143
- response = openai.ChatCompletion.create(
144
- model="gpt-4", # Replace with the GPT-4 model you are using
145
- messages=[
146
- {"role": "system", "content": "You are a helpful assistant."},
147
- {"role": "user", "content": user_input}
148
- ]
149
- )
150
 
151
- # Display the response from the API
152
- st.write(response.choices[0].message['content'])
 
1
  import streamlit as st
 
2
 
3
+ # Sample database of neighborhoods (replace with real data)
4
+ neighborhood_data = {
5
+ 'Neighborhood A': {'price_range': (300000, 500000), 'amenities': {'school': 2, 'park': 5}, 'distance': 10},
6
+ 'Neighborhood B': {'price_range': (200000, 400000), 'amenities': {'school': 5, 'supermarket': 3}, 'distance': 5},
7
+ # Add more neighborhoods...
8
+ }
9
 
10
+ def match_neighborhoods(price_range, amenities, max_distance):
11
+ matches = []
12
+ for name, data in neighborhood_data.items():
13
+ if data['price_range'][0] <= price_range[1] and data['price_range'][1] >= price_range[0]:
14
+ if all(amenity in data['amenities'] and data['amenities'][amenity] <= max_distance for amenity in amenities):
15
+ matches.append(name)
16
+ return matches
17
 
18
+ st.title('Neighborhood Matchmaker')
 
 
 
 
 
19
 
20
+ min_price, max_price = st.slider("Select your price range", 100000, 1000000, (200000, 500000))
21
+ selected_amenities = st.multiselect("Select desired amenities", ['school', 'park', 'supermarket', 'public transport'])
22
+ max_distance = st.selectbox("Maximum distance to amenities (in miles)", [1, 2, 5, 10, 20])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ if st.button('Find Match'):
25
+ matches = match_neighborhoods((min_price, max_price), selected_amenities, max_distance)
26
+ if matches:
27
+ st.write('Matching Neighborhoods:')
28
+ for match in matches:
29
+ st.write(match)
30
+ else:
31
+ st.write('No matches found. Try adjusting your criteria.')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
+ # Remember to handle user data responsibly.