EdBoy2202 commited on
Commit
20c8933
·
verified ·
1 Parent(s): cd648eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -143,16 +143,19 @@ if st.session_state.image is not None:
143
  if car_classifications:
144
  st.write("Image classification successful.")
145
  st.subheader("Car Classification Results:")
146
- for classification in car_classifications:
147
- st.write(f"Model: {classification['label']}")
148
- st.write(f"Confidence: {classification['score'] * 100:.2f}%")
149
 
150
  # Separate make and model from the classification result
151
  top_prediction = car_classifications[0]['label']
152
  make_name, model_name = top_prediction.split(' ', 1)
153
-
154
- st.write(f"Identified Car Make: {make_name}")
155
- st.write(f"Identified Car Model: {model_name}")
 
 
 
156
 
157
  # Find the closest match in the CSV based on the classification
158
  car_data = load_car_data()
@@ -162,8 +165,8 @@ if st.session_state.image is not None:
162
 
163
  # st.write(f"Closest match in database:")
164
  st.write(f"Year: {closest_car['year']}")
165
- st.write(f"Make: {label_encoders['make'].inverse_transform([closest_car['make']])[0]}")
166
- st.write(f"Model: {label_encoders['model'].inverse_transform([closest_car['model']])[0]}")
167
  st.write(f"Price: ${closest_car['price']}")
168
  st.write(f"Condition: {closest_car['condition']}")
169
  st.write(f"Fuel: {closest_car['fuel']}")
 
143
  if car_classifications:
144
  st.write("Image classification successful.")
145
  st.subheader("Car Classification Results:")
146
+ # for classification in car_classifications:
147
+ # st.write(f"Model: {classification['label']}")
148
+ # st.write(f"Confidence: {classification['score'] * 100:.2f}%")
149
 
150
  # Separate make and model from the classification result
151
  top_prediction = car_classifications[0]['label']
152
  make_name, model_name = top_prediction.split(' ', 1)
153
+
154
+ col1, col2= st.columns(2)
155
+ col1.metric("Identified Car Make", make_name)
156
+ col2.metric("Identified Car Model", model_name)
157
+ # st.write(f"Identified Car Model: {make_name}")
158
+ # st.write(f"Identified Car Model: {model_name}")
159
 
160
  # Find the closest match in the CSV based on the classification
161
  car_data = load_car_data()
 
165
 
166
  # st.write(f"Closest match in database:")
167
  st.write(f"Year: {closest_car['year']}")
168
+ # st.write(f"Make: {label_encoders['make'].inverse_transform([closest_car['make']])[0]}")
169
+ # st.write(f"Model: {label_encoders['model'].inverse_transform([closest_car['model']])[0]}")
170
  st.write(f"Price: ${closest_car['price']}")
171
  st.write(f"Condition: {closest_car['condition']}")
172
  st.write(f"Fuel: {closest_car['fuel']}")