Sync App files
Browse files- READme.md +11 -0
- drug_app.py +5 -5
- requirements.txt +2 -1
READme.md
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Drug Classification
|
3 |
+
emoji: π
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: red
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.16.0
|
8 |
+
app_file: drug_app.py
|
9 |
+
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
---
|
drug_app.py
CHANGED
@@ -1,15 +1,15 @@
|
|
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):
|
8 |
"""Predict drugs based on patient features.
|
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
|
@@ -19,7 +19,7 @@ def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio):
|
|
19 |
"""
|
20 |
features = [age, sex, blood_pressure, cholesterol, na_to_k_ratio]
|
21 |
predicted_drug = pipe.predict([features])[0]
|
22 |
-
|
23 |
label = f"Predicted Drug: {predicted_drug}"
|
24 |
return label
|
25 |
|
@@ -42,7 +42,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
|
46 |
|
47 |
|
48 |
gr.Interface(
|
|
|
1 |
import gradio as gr
|
2 |
import skops.io as sio
|
3 |
|
4 |
+
trusted_types = sio.get_untrusted_types(file="./Model/drug_pipeline.skops")
|
5 |
+
pipe = sio.load("./Model/drug_pipeline.skops", trusted=trusted_types)
|
6 |
|
7 |
def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio):
|
8 |
"""Predict drugs based on patient features.
|
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
|
|
|
19 |
"""
|
20 |
features = [age, sex, blood_pressure, cholesterol, na_to_k_ratio]
|
21 |
predicted_drug = pipe.predict([features])[0]
|
22 |
+
|
23 |
label = f"Predicted Drug: {predicted_drug}"
|
24 |
return label
|
25 |
|
|
|
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(
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
scikit-learn
|
2 |
-
skops
|
|
|
|
1 |
scikit-learn
|
2 |
+
skops
|
3 |
+
black
|