Spaces:
Sleeping
Sleeping
Syauqi Nabil Tasri commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,14 +30,46 @@ convex_area = st.number_input('Convex hull (convex area)', min_value=18068.0, ma
|
|
| 30 |
# prediction = model.predict(input_features)
|
| 31 |
# st.write(f'The predicted class is: {prediction[0]}')
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# Tombol untuk memprediksi
|
| 34 |
if st.button('Predict'):
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
prediction_proba = model.predict_proba(input_features)
|
| 40 |
-
|
| 41 |
-
st.write(f'The predicted class is: {prediction[0]}')
|
| 42 |
-
st.write(f'Prediction probabilities: {prediction_proba}')
|
| 43 |
|
|
|
|
| 30 |
# prediction = model.predict(input_features)
|
| 31 |
# st.write(f'The predicted class is: {prediction[0]}')
|
| 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 |
+
# prediction_proba = model.predict_proba(input_features)
|
| 40 |
+
|
| 41 |
+
# st.write(f'The predicted class is: {prediction[0]}')
|
| 42 |
+
# st.write(f'Prediction probabilities: {prediction_proba}')
|
| 43 |
+
|
| 44 |
+
# Input untuk beberapa fitur
|
| 45 |
+
num_samples = st.number_input('Number of samples', min_value=1, max_value=10, value=1)
|
| 46 |
+
|
| 47 |
+
input_features = []
|
| 48 |
+
for i in range(num_samples):
|
| 49 |
+
st.write(f'Sample {i + 1}')
|
| 50 |
+
features = []
|
| 51 |
+
length_major_axis = st.number_input('Length (major axis)', min_value=269.356903, max_value=279.879883, key=f'length_{i}')
|
| 52 |
+
width_minor_axis = st.number_input('Width (minor axis)', min_value=176.023636, max_value=227.940628, key=f'width_{i}')
|
| 53 |
+
thickness_depth = st.number_input('Thickness (depth)', min_value=107.253448, max_value=127.795132, key=f'thickness_{i}')
|
| 54 |
+
area = st.number_input('Area', min_value=18471.5, max_value=36683.0, key=f'area_{i}')
|
| 55 |
+
perimeter = st.number_input('Perimeter', min_value=551.688379, max_value=887.310743, key=f'perimeter_{i}')
|
| 56 |
+
roundness = st.slider('Roundness', min_value=0.472718, max_value=0.643761, step=0.01, key=f'roundness_{i}')
|
| 57 |
+
solidity = st.slider('Solidity', min_value=0.931800, max_value=0.973384, step=0.01, key=f'solidity_{i}')
|
| 58 |
+
compactness = st.slider('Compactness', min_value=1.383965, max_value=1.764701, step=0.01, key=f'compactness_{i}')
|
| 59 |
+
aspect_ratio = st.slider('Aspect Ratio', min_value=1.530231, max_value=1.705716, step=0.01, key=f'aspect_ratio_{i}')
|
| 60 |
+
eccentricity = st.slider('Eccentricity', min_value=0.75693, max_value=0.81012, step=0.01, key=f'eccentricity_{i}')
|
| 61 |
+
extent = st.slider('Extent', min_value=0.656535, max_value=0.725739, step=0.01, key=f'extent_{i}')
|
| 62 |
+
convex_area = st.number_input('Convex hull (convex area)', min_value=18068.0, max_value=36683.0, step=0.01, key=f'convex_area_{i}')
|
| 63 |
+
|
| 64 |
+
features = [length_major_axis, width_minor_axis, thickness_depth, area,
|
| 65 |
+
perimeter, roundness, solidity, compactness, aspect_ratio,
|
| 66 |
+
eccentricity, extent, convex_area]
|
| 67 |
+
input_features.append(features)
|
| 68 |
+
|
| 69 |
# Tombol untuk memprediksi
|
| 70 |
if st.button('Predict'):
|
| 71 |
+
predictions = model.predict(input_features)
|
| 72 |
+
for i, prediction in enumerate(predictions):
|
| 73 |
+
st.write(f'The predicted class for sample {i + 1} is: {prediction}')
|
| 74 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|