update app
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ st.markdown(
|
|
| 21 |
<style>
|
| 22 |
.main {
|
| 23 |
margin: 0 auto; /* Centers the content */
|
| 24 |
-
max-width:
|
| 25 |
|
| 26 |
}
|
| 27 |
</style>
|
|
@@ -251,17 +251,19 @@ car_types = ["convertible", "coupe", "estate", "hatchback", "sedan", "subcompact
|
|
| 251 |
|
| 252 |
st.subheader("5] API de Prédiction de la Valeur des Voitures GetAround")
|
| 253 |
|
| 254 |
-
col1, col2 = st.columns(
|
| 255 |
|
| 256 |
with col1:
|
| 257 |
-
marque = st.selectbox("Marque", car_brands, index=3)
|
| 258 |
kilometrage = st.number_input("Kilométrage", min_value=0, step=1000, value=10000)
|
| 259 |
puissance_moteur = st.number_input("Puissance du Moteur (HP)", min_value=0, step=10, value=100)
|
| 260 |
-
carburant = st.selectbox("Type de Carburant", fuel_types, index=0) # Par défaut "diesel"
|
| 261 |
-
couleur_peinture = st.selectbox("Couleur de la Peinture", paint_colors, index=0) # Par défaut "black"
|
| 262 |
-
type_voiture = st.selectbox("Type de Voiture", car_types, index=4) # Par défaut "sedan"
|
| 263 |
|
| 264 |
with col2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
parking_prive_disponible = st.checkbox("Parking Privé", value=True)
|
| 266 |
gps_disponible = st.checkbox("GPS Disponible", value=True)
|
| 267 |
climatisation_disponible = st.checkbox("Climatisation", value=True)
|
|
@@ -291,9 +293,11 @@ if st.button("Prédire la Valeur de la Voiture"):
|
|
| 291 |
|
| 292 |
response = requests.post(url, params=input_data)
|
| 293 |
|
| 294 |
-
# Afficher la réponse du serveur
|
| 295 |
if response.status_code == 200:
|
| 296 |
result = response.json()
|
| 297 |
-
|
|
|
|
|
|
|
| 298 |
else:
|
| 299 |
-
st.
|
|
|
|
|
|
| 21 |
<style>
|
| 22 |
.main {
|
| 23 |
margin: 0 auto; /* Centers the content */
|
| 24 |
+
max-width: 1100px;
|
| 25 |
|
| 26 |
}
|
| 27 |
</style>
|
|
|
|
| 251 |
|
| 252 |
st.subheader("5] API de Prédiction de la Valeur des Voitures GetAround")
|
| 253 |
|
| 254 |
+
col1, col2, col3 = st.columns(3)
|
| 255 |
|
| 256 |
with col1:
|
| 257 |
+
marque = st.selectbox("Marque", car_brands, index=3)
|
| 258 |
kilometrage = st.number_input("Kilométrage", min_value=0, step=1000, value=10000)
|
| 259 |
puissance_moteur = st.number_input("Puissance du Moteur (HP)", min_value=0, step=10, value=100)
|
|
|
|
|
|
|
|
|
|
| 260 |
|
| 261 |
with col2:
|
| 262 |
+
carburant = st.selectbox("Type de Carburant", fuel_types, index=0)
|
| 263 |
+
couleur_peinture = st.selectbox("Couleur de la Peinture", paint_colors, index=0)
|
| 264 |
+
type_voiture = st.selectbox("Type de Voiture", car_types, index=0)
|
| 265 |
+
|
| 266 |
+
with col3:
|
| 267 |
parking_prive_disponible = st.checkbox("Parking Privé", value=True)
|
| 268 |
gps_disponible = st.checkbox("GPS Disponible", value=True)
|
| 269 |
climatisation_disponible = st.checkbox("Climatisation", value=True)
|
|
|
|
| 293 |
|
| 294 |
response = requests.post(url, params=input_data)
|
| 295 |
|
|
|
|
| 296 |
if response.status_code == 200:
|
| 297 |
result = response.json()
|
| 298 |
+
result = response.json()
|
| 299 |
+
prediction_value = round(result["prediction"], 2)
|
| 300 |
+
st.success(f"Prix de la location {prediction_value} $/jour")
|
| 301 |
else:
|
| 302 |
+
st.error(f"Erreur: {response.status_code}")
|
| 303 |
+
st.write(response.text)
|