Skip to content

Commit

Permalink
app and readme improved with badges and article.
Browse files Browse the repository at this point in the history
  • Loading branch information
kingabzpro committed Feb 8, 2024
1 parent b9a0c6a commit 4085181
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"CodeGPT.apiKey": "Anthropic",
"CodeGPT.Autocomplete.enabled": true
}
39 changes: 26 additions & 13 deletions App/drug_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
pipe = sio.load("./Model/drug_pipeline.skops", trusted=True)


def classifier(Age, Sex, BP, Cholesterol, Na_to_K):
"""
This function takes input features Age, Sex, BP, Cholesterol, and Na_to_K,
and uses a sklearn pipeline to make a prediction on the glass label.
def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio):
"""Predict drug based on patient features.
Args:
Age (float): The age of the patient
Sex (str): The sex of the patient (M or F)
BP (str): The blood pressure of the patient (HIGH, NORMAL, or LOW)
Cholesterol (str): The cholesterol level of the patient (HIGH or NORMAL)
Na_to_K (float): The ratio of sodium to potassium in the patient's blood
age (int): Age of patient
sex (int): Sex of patient (0 for female, 1 for male)
blood_pressure (int): Blood pressure level
cholesterol (int): Cholesterol level
na_to_k_ratio (float): Ratio of sodium to potassium in blood
Returns:
str: A string with the predicted drug label
str: Predicted drug label
"""
pred_drug = pipe.predict([[Age, Sex, BP, Cholesterol, Na_to_K]])[0]
label = f"Predicted Drug label: **{pred_drug}**"
features = [age, sex, blood_pressure, cholesterol, na_to_k_ratio]
predicted_drug = pipe.predict([features])[0]

label = f"Predicted Drug: {predicted_drug}"
return label


Expand All @@ -42,12 +42,25 @@ def classifier(Age, Sex, BP, Cholesterol, Na_to_K):

title = "Drug Classification"
description = "Enter the details to correctly identify Drug type?"
article = """<center>
[![GitHub Repo stars](https://img.shields.io/github/stars/kingabzpro/CICD-for-Machine-Learning)](https://github.com/kingabzpro/CICD-for-Machine-Learning)[![Follow me on HF](https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-me-on-HF-md.svg)](https://huggingface.co/kingabzpro)
**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.**
[![DataCamp](https://img.shields.io/badge/Datacamp-05192D?style=for-the-badge&logo=datacamp&logoColor=65FF8F)](https://www.datacamp.com/portfolio/kingabzpro)
</center>"""

gr.Interface(
fn=classifier,
fn=predict_drug,
inputs=inputs,
outputs=outputs,
examples=examples,
title=title,
description=description,
article=article,
theme=gr.themes.Soft(),
).launch()
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
[![Continuous Deployment](https://github.com/kingabzpro/CICD-for-Machine-Learning/actions/workflows/cd.yml/badge.svg)](https://github.com/kingabzpro/CICD-for-Machine-Learning/actions/workflows/cd.yml)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kingabzpro/CICD-for-Machine-Learning/blob/main/notebook.ipynb)

[![DataCamp](https://img.shields.io/badge/Datacamp-05192D?style=for-the-badge&logo=datacamp&logoColor=65FF8F)](https://www.datacamp.com/portfolio/kingabzpro) [![Open in Spaces](https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-md-dark.svg)](https://huggingface.co/spaces/kingabzpro/Drug-Classification)


Beginner's Guide to Automating Training, Evaluation, and Deploying Models using GitHub Actions.
## Pipeline

Expand Down

1 comment on commit 4085181

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model Metrics

Accuracy = 0.98, F1 Score = 0.98

Confusion Matrix Plot

Confusion Matrix

Please sign in to comment.