nishantguvvada commited on
Commit
784eb37
·
verified ·
1 Parent(s): 77f0edd

Sync App files

Browse files
Files changed (1) hide show
  1. drug_app.py +21 -4
drug_app.py CHANGED
@@ -1,7 +1,24 @@
1
  import gradio as gr
2
  import skops.io as sio
 
 
3
 
4
- pipe = sio.load("./Model/drug_pipeline.skops", trusted=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
 
7
  def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio):
@@ -9,7 +26,7 @@ def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio):
9
 
10
  Args:
11
  age (int): Age of patient
12
- sex (str): Sex of patient
13
  blood_pressure (str): Blood pressure level
14
  cholesterol (str): Cholesterol level
15
  na_to_k_ratio (float): Ratio of sodium to potassium in blood
@@ -42,7 +59,7 @@ examples = [
42
 
43
  title = "Drug Classification"
44
  description = "Enter the details to correctly identify Drug type?"
45
- article = "This app is a part of the Beginner's Guide to CI/CD for Machine Learning. It teaches how to automate training, evaluation, and deployment of models to Hugging Face using GitHub Actions."
46
 
47
 
48
  gr.Interface(
@@ -54,4 +71,4 @@ gr.Interface(
54
  description=description,
55
  article=article,
56
  theme=gr.themes.Soft(),
57
- ).launch()
 
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):
 
26
 
27
  Args:
28
  age (int): Age of patient
29
+ sex (str): Sex of patient
30
  blood_pressure (str): Blood pressure level
31
  cholesterol (str): Cholesterol level
32
  na_to_k_ratio (float): Ratio of sodium to potassium in blood
 
59
 
60
  title = "Drug Classification"
61
  description = "Enter the details to correctly identify Drug type?"
62
+ article = "This app is a part of the **[Beginner's Guide to CI/CD for Machine Learning](https://www.datacamp.com/tutorial/ci-cd-for-machine-learning)**. It teaches how to automate training, evaluation, and deployment of models to Hugging Face using GitHub Actions."
63
 
64
 
65
  gr.Interface(
 
71
  description=description,
72
  article=article,
73
  theme=gr.themes.Soft(),
74
+ ).launch()