Spaces:
Sleeping
Sleeping
Syauqi Nabil Tasri commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,12 +32,23 @@ convex_area = st.number_input('Convex hull (convex area)', min_value=18068.0, ma
|
|
| 32 |
|
| 33 |
# Tombol untuk memprediksi
|
| 34 |
if st.button('Predict'):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
input_features = [[length_major_axis, width_minor_axis, thickness_depth, area,
|
| 36 |
perimeter, roundness, solidity, compactness, aspect_ratio,
|
| 37 |
eccentricity, extent, convex_area]]
|
| 38 |
-
prediction = model.predict(input_features)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
# Menggunakan mapping untuk mendapatkan nama tipe almond
|
| 41 |
predicted_class_name = class_mapping[prediction[0]]
|
| 42 |
|
| 43 |
st.write(f'The predicted class is: {predicted_class_name}')
|
|
|
|
|
|
| 32 |
|
| 33 |
# Tombol untuk memprediksi
|
| 34 |
if st.button('Predict'):
|
| 35 |
+
# Muat scaler
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# Input dari pengguna
|
| 39 |
input_features = [[length_major_axis, width_minor_axis, thickness_depth, area,
|
| 40 |
perimeter, roundness, solidity, compactness, aspect_ratio,
|
| 41 |
eccentricity, extent, convex_area]]
|
|
|
|
| 42 |
|
| 43 |
+
# Lakukan scaling pada input
|
| 44 |
+
input_features_scaled = model.transform(input_features)
|
| 45 |
+
|
| 46 |
+
# Prediksi menggunakan model
|
| 47 |
+
prediction = model.predict(input_features_scaled)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
# Menggunakan mapping untuk mendapatkan nama tipe almond
|
| 51 |
predicted_class_name = class_mapping[prediction[0]]
|
| 52 |
|
| 53 |
st.write(f'The predicted class is: {predicted_class_name}')
|
| 54 |
+
|