Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -123,55 +123,55 @@ if camera_image is not None:
|
|
123 |
if car_info:
|
124 |
st.write(f"Identified Car: {car_info}")
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
else:
|
173 |
-
st.write("No match found in the database.")
|
174 |
else:
|
175 |
-
st.
|
|
|
|
|
176 |
else:
|
177 |
st.write("Please take a picture of the car to proceed.")
|
|
|
123 |
if car_info:
|
124 |
st.write(f"Identified Car: {car_info}")
|
125 |
|
126 |
+
# Find the closest match in the CSV
|
127 |
+
match = find_closest_match(df, brand, model_name)
|
128 |
+
if match is not None:
|
129 |
+
st.write("Closest Match Found:")
|
130 |
+
st.write(match)
|
131 |
+
|
132 |
+
# Get additional information using GPT-3.5-turbo
|
133 |
+
overview = get_car_overview(match)
|
134 |
+
st.write("Car Overview:")
|
135 |
+
st.write(overview)
|
136 |
+
|
137 |
+
# Interactive Price Prediction
|
138 |
+
st.subheader("Price Prediction Over Time")
|
139 |
+
selected_years = st.slider("Select range of years for price prediction",
|
140 |
+
min_value=2000, max_value=2023, value=(2010, 2023))
|
141 |
+
|
142 |
+
years = np.arange(selected_years[0], selected_years[1] + 1)
|
143 |
+
predicted_prices = []
|
144 |
+
|
145 |
+
for year in years:
|
146 |
+
user_input = {
|
147 |
+
'Make': brand,
|
148 |
+
'Model': model_name,
|
149 |
+
'Condition': match['Condition'],
|
150 |
+
'Fuel': match['Fuel'],
|
151 |
+
'Title_status': match['Title_status'],
|
152 |
+
'Transmission': match['Transmission'],
|
153 |
+
'Drive': match['Drive'],
|
154 |
+
'Size': match['Size'],
|
155 |
+
'Type': match['Type'],
|
156 |
+
'Paint_color': match['Paint_color'],
|
157 |
+
'Year': year
|
158 |
+
}
|
159 |
+
|
160 |
+
price = predict_price(model, label_encoders, user_input)
|
161 |
+
predicted_prices.append(price)
|
162 |
+
|
163 |
+
# Plotting the results
|
164 |
+
plt.figure(figsize=(10, 5))
|
165 |
+
plt.plot(years, predicted_prices, marker='o')
|
166 |
+
plt.title(f"Predicted Price of {brand} {model_name} Over Time")
|
167 |
+
plt.xlabel("Year")
|
168 |
+
plt.ylabel("Predicted Price ($)")
|
169 |
+
plt.grid()
|
170 |
+
st.pyplot(plt)
|
171 |
+
|
|
|
|
|
172 |
else:
|
173 |
+
st.write("No match found in the database.")
|
174 |
+
else:
|
175 |
+
st.error("Could not identify the brand or model. Please try again.")
|
176 |
else:
|
177 |
st.write("Please take a picture of the car to proceed.")
|