Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,17 @@ df = pd.read_csv('processed_data.csv') # Replace with the correct path to your
|
|
14 |
with open('label_encoder.pkl', 'rb') as f:
|
15 |
label_encoder = pickle.load(f)
|
16 |
|
|
|
|
|
17 |
ct = ColumnTransformer(
|
18 |
-
transformers=[('encoder', OneHotEncoder(sparse_output=False, drop="first"),
|
19 |
remainder="passthrough"
|
20 |
)
|
|
|
|
|
|
|
|
|
|
|
21 |
# Assuming 'ct' is your ColumnTransformer (replace this with the actual loading code for your preprocessor)
|
22 |
# Make sure that 'ct' is properly loaded, or use the same transformation logic here.
|
23 |
|
|
|
14 |
with open('label_encoder.pkl', 'rb') as f:
|
15 |
label_encoder = pickle.load(f)
|
16 |
|
17 |
+
categorical_features = [0, 1, 9, 10] # Update if column positions change
|
18 |
+
|
19 |
ct = ColumnTransformer(
|
20 |
+
transformers=[('encoder', OneHotEncoder(sparse_output=False, drop="first"), categorical_features)],
|
21 |
remainder="passthrough"
|
22 |
)
|
23 |
+
|
24 |
+
# Fit it using your training data
|
25 |
+
ct.fit(df[['Gender', 'Race (Reported)', 'Cyp2C9 genotypes', 'VKORC1 genotype: -1639 G>A (3673); chr16:31015190; rs9923231; C/T']])
|
26 |
+
|
27 |
+
|
28 |
# Assuming 'ct' is your ColumnTransformer (replace this with the actual loading code for your preprocessor)
|
29 |
# Make sure that 'ct' is properly loaded, or use the same transformation logic here.
|
30 |
|