Spaces:
Sleeping
Sleeping
Sync App files
Browse files- drug_app.py +18 -1
drug_app.py
CHANGED
|
@@ -1,7 +1,24 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import skops.io as sio
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import skops.io as sio
|
| 3 |
+
import warnings
|
| 4 |
+
from sklearn.exceptions import InconsistentVersionWarning
|
| 5 |
|
| 6 |
+
# Suppress the version warnings
|
| 7 |
+
warnings.filterwarnings("ignore", category=InconsistentVersionWarning)
|
| 8 |
+
|
| 9 |
+
# Explicitly specify trusted types
|
| 10 |
+
trusted_types = [
|
| 11 |
+
"sklearn.pipeline.Pipeline",
|
| 12 |
+
"sklearn.preprocessing.OneHotEncoder",
|
| 13 |
+
"sklearn.preprocessing.StandardScaler",
|
| 14 |
+
"sklearn.compose.ColumnTransformer",
|
| 15 |
+
"sklearn.preprocessing.OrdinalEncoder",
|
| 16 |
+
"sklearn.impute.SimpleImputer",
|
| 17 |
+
"sklearn.tree.DecisionTreeClassifier",
|
| 18 |
+
"sklearn.ensemble.RandomForestClassifier",
|
| 19 |
+
"numpy.dtype",
|
| 20 |
+
]
|
| 21 |
+
pipe = sio.load("./Model/drug_pipeline.skops", trusted=trusted_types)
|
| 22 |
|
| 23 |
|
| 24 |
def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio):
|