ErenKontas commited on
Commit
54203a1
·
verified ·
1 Parent(s): 9ffeae4

Upload 4 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ MiningProcess_Flotation_Plant_Database.csv filter=lfs diff=lfs merge=lfs -text
MiningProcess_Flotation_Plant_Database.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae0231a0bd2e14aac39cf978d81db6c71907a42aade19327816692c4e30cb956
3
+ size 183766261
Silisyum.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a555a6a6c7d5c4a3f80ba437b9dbcdc817f84c8c0085ec73ccca7f7c849c5ab
3
+ size 627483
app.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import streamlit as st
3
+ import joblib
4
+
5
+ from sklearn.preprocessing import StandardScaler, OneHotEncoder
6
+ from sklearn.model_selection import train_test_split
7
+ from sklearn.compose import ColumnTransformer
8
+
9
+ # Veriyi yükleme ve sütun isimlerini güncelleme
10
+ df = pd.read_csv('MiningProcess_Flotation_Plant_Database.csv')
11
+ df.columns = df.columns.str.replace(r'[\s\.]', '_', regex=True)
12
+ df.columns = df.columns.str.replace(r'%_Silica_Feed', 'Silica_Feed', regex=True)
13
+ df.columns = df.columns.str.replace(r'%_Silica_Concentrate', 'Silica_Concentrate', regex=True)
14
+ columns_to_convert = df.columns.difference(['date'])
15
+ df[columns_to_convert] = df[columns_to_convert].replace(',', '.', regex=True).astype(float)
16
+
17
+
18
+ # Bağımlı ve bağımsız değişkenlerin seçimi
19
+ x = df.drop(['date','%_Iron_Feed','%_Iron_Concentrate', 'Silica_Concentrate'], axis=1)
20
+ y = df[['Silica_Concentrate']]
21
+
22
+ # Eğitim ve test verilerini ayırma
23
+ x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.20, random_state=42)
24
+
25
+ # Ön işleme (StandardScaler ve OneHotEncoder)
26
+ preprocessor = ColumnTransformer(
27
+ transformers=[
28
+ ('num', StandardScaler(), ['Silica_Feed','Starch_Flow','Amina_Flow','Ore_Pulp_Flow','Ore_Pulp_pH','Ore_Pulp_Density',
29
+ 'Flotation_Column_01_Air_Flow','Flotation_Column_02_Air_Flow','Flotation_Column_03_Air_Flow',
30
+ 'Flotation_Column_04_Air_Flow','Flotation_Column_05_Air_Flow','Flotation_Column_06_Air_Flow',
31
+ 'Flotation_Column_07_Air_Flow','Flotation_Column_01_Level','Flotation_Column_02_Level',
32
+ 'Flotation_Column_03_Level','Flotation_Column_04_Level','Flotation_Column_05_Level',
33
+ 'Flotation_Column_06_Level','Flotation_Column_07_Level'])
34
+ ]
35
+ )
36
+
37
+ def silica_pred(Silica_Feed,Starch_Flow,Amina_Flow,Ore_Pulp_Flow,Ore_Pulp_pH,Ore_Pulp_Density,Flotation_Column_01_Air_Flow,
38
+ Flotation_Column_02_Air_Flow,Flotation_Column_03_Air_Flow,Flotation_Column_04_Air_Flow,Flotation_Column_05_Air_Flow,
39
+ Flotation_Column_06_Air_Flow,Flotation_Column_07_Air_Flow,Flotation_Column_01_Level,Flotation_Column_02_Level,
40
+ Flotation_Column_03_Level,Flotation_Column_04_Level,Flotation_Column_05_Level,Flotation_Column_06_Level,
41
+ Flotation_Column_07_Level):
42
+ input_data = pd.DataFrame({
43
+ 'Silica_Feed': [Silica_Feed],
44
+ 'Starch_Flow': [Starch_Flow],
45
+ 'Amina_Flow': [Amina_Flow],
46
+ 'Ore_Pulp_Flow': [Ore_Pulp_Flow],
47
+ 'Ore_Pulp_pH': [Ore_Pulp_pH],
48
+ 'Ore_Pulp_Density': [Ore_Pulp_Density],
49
+ 'Flotation_Column_01_Air_Flow': [Flotation_Column_01_Air_Flow],
50
+ 'Flotation_Column_02_Air_Flow': [Flotation_Column_02_Air_Flow],
51
+ 'Flotation_Column_03_Air_Flow': [Flotation_Column_03_Air_Flow],
52
+ 'Flotation_Column_04_Air_Flow': [Flotation_Column_04_Air_Flow],
53
+ 'Flotation_Column_05_Air_Flow': [Flotation_Column_05_Air_Flow],
54
+ 'Flotation_Column_06_Air_Flow': [Flotation_Column_06_Air_Flow],
55
+ 'Flotation_Column_07_Air_Flow': [Flotation_Column_07_Air_Flow],
56
+ 'Flotation_Column_01_Level': [Flotation_Column_01_Level],
57
+ 'Flotation_Column_02_Level': [Flotation_Column_02_Level],
58
+ 'Flotation_Column_03_Level': [Flotation_Column_03_Level],
59
+ 'Flotation_Column_04_Level': [Flotation_Column_04_Level],
60
+ 'Flotation_Column_05_Level': [Flotation_Column_05_Level],
61
+ 'Flotation_Column_06_Level': [Flotation_Column_06_Level],
62
+ 'Flotation_Column_07_Level': [Flotation_Column_07_Level]
63
+ })
64
+ input_data_transformed = preprocessor.fit_transform(input_data)
65
+
66
+ model = joblib.load('Silisyum.pkl')
67
+
68
+ prediction = model.predict(input_data_transformed)
69
+ return float(prediction[0])
70
+
71
+ min_Silica_Feed = x['Silica_Feed'].min()
72
+ max_Silica_Feed = x['Silica_Feed'].max()
73
+ min_Starch_Flow = x['Starch_Flow'].min()
74
+ max_Starch_Flow = x['Starch_Flow'].max()
75
+ min_Amina_Flow = x['Amina_Flow'].min()
76
+ max_Amina_Flow = x['Amina_Flow'].max()
77
+ min_Ore_Pulp_Flow = x['Ore_Pulp_Flow'].min()
78
+ max_Ore_Pulp_Flow = x['Ore_Pulp_Flow'].max()
79
+ min_Ore_Pulp_pH = x['Ore_Pulp_pH'].min()
80
+ max_Ore_Pulp_pH = x['Ore_Pulp_pH'].max()
81
+ min_Ore_Pulp_Density = x['Ore_Pulp_Density'].min()
82
+ max_Ore_Pulp_Density = x['Ore_Pulp_Density'].max()
83
+ min_Flotation_Column_01_Air_Flow = x['Flotation_Column_01_Air_Flow'].min()
84
+ max_Flotation_Column_01_Air_Flow = x['Flotation_Column_01_Air_Flow'].max()
85
+ min_Flotation_Column_02_Air_Flow = x['Flotation_Column_02_Air_Flow'].min()
86
+ max_Flotation_Column_02_Air_Flow = x['Flotation_Column_02_Air_Flow'].max()
87
+ min_Flotation_Column_03_Air_Flow = x['Flotation_Column_03_Air_Flow'].min()
88
+ max_Flotation_Column_03_Air_Flow = x['Flotation_Column_03_Air_Flow'].max()
89
+ min_Flotation_Column_04_Air_Flow = x['Flotation_Column_04_Air_Flow'].min()
90
+ max_Flotation_Column_04_Air_Flow = x['Flotation_Column_04_Air_Flow'].max()
91
+ min_Flotation_Column_05_Air_Flow = x['Flotation_Column_05_Air_Flow'].min()
92
+ max_Flotation_Column_05_Air_Flow = x['Flotation_Column_05_Air_Flow'].max()
93
+ min_Flotation_Column_06_Air_Flow = x['Flotation_Column_06_Air_Flow'].min()
94
+ max_Flotation_Column_06_Air_Flow = x['Flotation_Column_06_Air_Flow'].max()
95
+ min_Flotation_Column_07_Air_Flow = x['Flotation_Column_07_Air_Flow'].min()
96
+ max_Flotation_Column_07_Air_Flow = x['Flotation_Column_07_Air_Flow'].max()
97
+ min_Flotation_Column_01_Level = x['Flotation_Column_01_Level'].min()
98
+ max_Flotation_Column_01_Level = x['Flotation_Column_01_Level'].max()
99
+ min_Flotation_Column_02_Level = x['Flotation_Column_02_Level'].min()
100
+ max_Flotation_Column_02_Level = x['Flotation_Column_02_Level'].max()
101
+ min_Flotation_Column_03_Level = x['Flotation_Column_03_Level'].min()
102
+ max_Flotation_Column_03_Level = x['Flotation_Column_03_Level'].max()
103
+ min_Flotation_Column_04_Level = x['Flotation_Column_04_Level'].min()
104
+ max_Flotation_Column_04_Level = x['Flotation_Column_04_Level'].max()
105
+ min_Flotation_Column_05_Level = x['Flotation_Column_05_Level'].min()
106
+ max_Flotation_Column_05_Level = x['Flotation_Column_05_Level'].max()
107
+ min_Flotation_Column_06_Level = x['Flotation_Column_06_Level'].min()
108
+ max_Flotation_Column_06_Level = x['Flotation_Column_06_Level'].max()
109
+ min_Flotation_Column_07_Level = x['Flotation_Column_07_Level'].min()
110
+ max_Flotation_Column_07_Level = x['Flotation_Column_07_Level'].max()
111
+
112
+ st.title("Maden Veri seti ile Silica saflık Regresyon Modeli")
113
+ st.write("Veri Gir")
114
+
115
+ Silica_Feed = st.slider('Silica_Feed', float(min_Silica_Feed), float(max_Silica_Feed))
116
+ Starch_Flow = st.slider('Starch_Flow', float(min_Starch_Flow), float(max_Starch_Flow))
117
+ Amina_Flow = st.slider('Amina_Flow', float(min_Amina_Flow), float(max_Amina_Flow))
118
+ Ore_Pulp_Flow = st.slider('Ore_Pulp_Flow', float(min_Ore_Pulp_Flow), float(max_Ore_Pulp_Flow))
119
+ Ore_Pulp_pH = st.slider('Ore_Pulp_pH', float(min_Ore_Pulp_pH), float(max_Ore_Pulp_pH))
120
+ Ore_Pulp_Density = st.slider('Ore_Pulp_Density', float(min_Ore_Pulp_Density), float(max_Ore_Pulp_Density))
121
+ Flotation_Column_01_Air_Flow = st.slider('Flotation_Column_01_Air_Flow', float(min_Flotation_Column_01_Air_Flow), float(max_Flotation_Column_01_Air_Flow))
122
+ Flotation_Column_02_Air_Flow = st.slider('Flotation_Column_02_Air_Flow', float(min_Flotation_Column_02_Air_Flow), float(max_Flotation_Column_02_Air_Flow))
123
+ Flotation_Column_03_Air_Flow = st.slider('Flotation_Column_03_Air_Flow', float(min_Flotation_Column_03_Air_Flow), float(max_Flotation_Column_03_Air_Flow))
124
+ Flotation_Column_04_Air_Flow = st.slider('Flotation_Column_04_Air_Flow', float(min_Flotation_Column_04_Air_Flow), float(max_Flotation_Column_04_Air_Flow))
125
+ Flotation_Column_05_Air_Flow = st.slider('Flotation_Column_05_Air_Flow', float(min_Flotation_Column_05_Air_Flow), float(max_Flotation_Column_05_Air_Flow))
126
+ Flotation_Column_06_Air_Flow = st.slider('Flotation_Column_06_Air_Flow', float(min_Flotation_Column_06_Air_Flow), float(max_Flotation_Column_06_Air_Flow))
127
+ Flotation_Column_07_Air_Flow = st.slider('Flotation_Column_07_Air_Flow', float(min_Flotation_Column_07_Air_Flow), float(max_Flotation_Column_07_Air_Flow))
128
+ Flotation_Column_01_Level = st.slider('Flotation_Column_01_Level', float(min_Flotation_Column_01_Level), float(max_Flotation_Column_01_Level))
129
+ Flotation_Column_02_Level = st.slider('Flotation_Column_02_Level', float(min_Flotation_Column_02_Level), float(max_Flotation_Column_02_Level))
130
+ Flotation_Column_03_Level = st.slider('Flotation_Column_03_Level', float(min_Flotation_Column_03_Level), float(max_Flotation_Column_03_Level))
131
+ Flotation_Column_04_Level = st.slider('Flotation_Column_04_Level', float(min_Flotation_Column_04_Level), float(max_Flotation_Column_04_Level))
132
+ Flotation_Column_05_Level = st.slider('Flotation_Column_05_Level', float(min_Flotation_Column_05_Level), float(max_Flotation_Column_05_Level))
133
+ Flotation_Column_06_Level = st.slider('Flotation_Column_06_Level', float(min_Flotation_Column_06_Level), float(max_Flotation_Column_06_Level))
134
+ Flotation_Column_07_Level = st.slider('Flotation_Column_07_Level', float(min_Flotation_Column_07_Level), float(max_Flotation_Column_07_Level))
135
+
136
+
137
+ # Predict button
138
+ if st.button('Silica Saflığını Tahmin Et'):
139
+ prediction = silica_pred(Silica_Feed, Starch_Flow, Amina_Flow, Ore_Pulp_Flow, Ore_Pulp_pH, Ore_Pulp_Density,
140
+ Flotation_Column_01_Air_Flow, Flotation_Column_02_Air_Flow, Flotation_Column_03_Air_Flow,
141
+ Flotation_Column_04_Air_Flow, Flotation_Column_05_Air_Flow, Flotation_Column_06_Air_Flow,
142
+ Flotation_Column_07_Air_Flow, Flotation_Column_01_Level, Flotation_Column_02_Level,
143
+ Flotation_Column_03_Level, Flotation_Column_04_Level, Flotation_Column_05_Level,
144
+ Flotation_Column_06_Level, Flotation_Column_07_Level)
145
+
146
+ st.write(f'Tahmin edilen Silica Saflığı: {prediction:.2f}')
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ streamlit
2
+ scikit-learn
3
+ pandas
4
+ tensorflow