ibrahimnomad commited on
Commit
c1535a2
1 Parent(s): 7165e1c

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +55 -0
  2. model.pkl +3 -0
  3. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import pickle
4
+
5
+ # Load the saved model
6
+ with open("model.pkl", "rb") as file:
7
+ model = pickle.load(file)
8
+
9
+
10
+ # Title of the app
11
+ st.title("Abalone Rings Predictor 🦪")
12
+ st.write("An abalone is a type of shellfish, specifically a large sea snail belonging to the family Haliotidae. There are around 30 to 130 recognized species of abalone found in warm and cold coastal waters around the world. The rings, or rather the iridescent inner layer of the abalone shell, called mother-of-pearl, is what makes them so important. This layer is highly sought after for its beauty. It has a mesmerizing play of colors that shifts and changes depending on the light. These colors come from the way light interacts with the microscopic layers that make up the nacre.")
13
+ st.image('https://i.pinimg.com/1200x/76/8c/e0/768ce06773574e045ff808e16ec341dc.jpg')
14
+
15
+ # Instructions
16
+ st.write("Enter the details of an abalone below to predict the number of rings it has.")
17
+
18
+ # Prefilled example values
19
+ example_data = {
20
+ 'Sex': 'F',
21
+ 'Length': 0.550,
22
+ 'Diameter': 0.430,
23
+ 'Height': 0.150,
24
+ 'Whole weight': 0.7715,
25
+ 'Whole weight.1': 0.3285,
26
+ 'Whole weight.2': 0.1465,
27
+ 'Shell weight': 0.2400,
28
+ }
29
+
30
+ # Input fields for the user
31
+ sex = st.selectbox("Sex", ["M", "F", "I"], index=["M", "F", "I"].index(example_data['Sex']))
32
+ length = st.number_input("Length", min_value=0.0, max_value=1.0, step=0.1, value=example_data['Length'])
33
+ diameter = st.number_input("Diameter", min_value=0.0, max_value=1.0, step=0.1, value=example_data['Diameter'])
34
+ height = st.number_input("Height", min_value=0.0, max_value=1.0, step=0.1, value=example_data['Height'])
35
+ whole_weight = st.number_input("Whole weight", min_value=0.0, step=0.1, value=example_data['Whole weight'])
36
+ whole_weight_1 = st.number_input("Whole weight 1", min_value=0.0, step=0.1, value=example_data['Whole weight.1'])
37
+ whole_weight_2 = st.number_input("Whole weight 2", min_value=0.0, step=0.1, value=example_data['Whole weight.2'])
38
+ shell_weight = st.number_input("Shell weight", min_value=0.0, step=0.1, value=example_data['Shell weight'])
39
+
40
+ # Prediction
41
+ if st.button("Predict"):
42
+ input_data = pd.DataFrame({
43
+ 'Sex': [sex],
44
+ 'Length': [length],
45
+ 'Diameter': [diameter],
46
+ 'Height': [height],
47
+ 'Whole weight': [whole_weight],
48
+ 'Whole weight.1': [whole_weight_1],
49
+ 'Whole weight.2': [whole_weight_2],
50
+ 'Shell weight': [shell_weight]
51
+ })
52
+ input_data['Sex'] = input_data['Sex'].map({'M': 0, 'F': 1, 'I': 2})
53
+
54
+ prediction = model.predict(input_data)
55
+ st.header(f"The predicted number of rings is: ***{int(prediction[0])}***")
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26e817ae451806c8989eff8b3f61c97a67217bf4b035ce3248cb6b8030c3ca78
3
+ size 1118927
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ catboost
2
+ scikit-learn=1.2.2