Spaces:
Sleeping
Sleeping
Kamil Piekarz commited on
Commit ·
f500d3b
1
Parent(s): 6f140d0
adjusted README
Browse files- .idea/.gitignore +3 -0
- .idea/SUML_CI-CD.iml +12 -0
- .idea/inspectionProfiles/Project_Default.xml +13 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- README.md +1 -1
- drug_app.py +0 -54
.idea/.gitignore
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Default ignored files
|
| 2 |
+
/shelf/
|
| 3 |
+
/workspace.xml
|
.idea/SUML_CI-CD.iml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<module type="PYTHON_MODULE" version="4">
|
| 3 |
+
<component name="NewModuleRootManager">
|
| 4 |
+
<content url="file://$MODULE_DIR$" />
|
| 5 |
+
<orderEntry type="inheritedJdk" />
|
| 6 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
| 7 |
+
</component>
|
| 8 |
+
<component name="PyDocumentationSettings">
|
| 9 |
+
<option name="format" value="GOOGLE" />
|
| 10 |
+
<option name="myDocStringFormat" value="Google" />
|
| 11 |
+
</component>
|
| 12 |
+
</module>
|
.idea/inspectionProfiles/Project_Default.xml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<component name="InspectionProjectProfileManager">
|
| 2 |
+
<profile version="1.0">
|
| 3 |
+
<option name="myName" value="Project Default" />
|
| 4 |
+
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
| 5 |
+
<option name="ignoredIdentifiers">
|
| 6 |
+
<list>
|
| 7 |
+
<option value="streamlit" />
|
| 8 |
+
<option value="pandas" />
|
| 9 |
+
</list>
|
| 10 |
+
</option>
|
| 11 |
+
</inspection_tool>
|
| 12 |
+
</profile>
|
| 13 |
+
</component>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<component name="InspectionProjectProfileManager">
|
| 2 |
+
<settings>
|
| 3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
| 4 |
+
<version value="1.0" />
|
| 5 |
+
</settings>
|
| 6 |
+
</component>
|
.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="ProjectModuleManager">
|
| 4 |
+
<modules>
|
| 5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/SUML_CI-CD.iml" filepath="$PROJECT_DIR$/.idea/SUML_CI-CD.iml" />
|
| 6 |
+
</modules>
|
| 7 |
+
</component>
|
| 8 |
+
</project>
|
.idea/vcs.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="VcsDirectoryMappings">
|
| 4 |
+
<mapping directory="" vcs="Git" />
|
| 5 |
+
</component>
|
| 6 |
+
</project>
|
README.md
CHANGED
|
@@ -5,7 +5,7 @@ colorFrom: indigo
|
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.34.0
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
|
|
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.34.0
|
| 8 |
+
app_file: add_click_app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
drug_app.py
DELETED
|
@@ -1,54 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import skops.io as sio
|
| 3 |
-
|
| 4 |
-
# Załaduj model - podaj trusted! (to na 99% będzie numpy.dtype)
|
| 5 |
-
pipe = sio.load("./Model/drug_pipeline.skops", trusted=["numpy.dtype"])
|
| 6 |
-
|
| 7 |
-
def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio):
|
| 8 |
-
"""
|
| 9 |
-
Predict drugs based on patient features.
|
| 10 |
-
|
| 11 |
-
Args:
|
| 12 |
-
age (int): Age of patient
|
| 13 |
-
sex (str): Sex of patient
|
| 14 |
-
blood_pressure (str): Blood pressure level
|
| 15 |
-
cholesterol (str): Cholesterol level
|
| 16 |
-
na_to_k_ratio (float): Ratio of sodium to potassium in blood
|
| 17 |
-
|
| 18 |
-
Returns:
|
| 19 |
-
str: Predicted drug label
|
| 20 |
-
"""
|
| 21 |
-
features = [age, sex, blood_pressure, cholesterol, na_to_k_ratio]
|
| 22 |
-
predicted_drug = pipe.predict([features])[0]
|
| 23 |
-
label = f"Predicted Drug: {predicted_drug}"
|
| 24 |
-
return label
|
| 25 |
-
|
| 26 |
-
inputs = [
|
| 27 |
-
gr.Slider(15, 74, step=1, label="Age"),
|
| 28 |
-
gr.Radio(["M", "F"], label="Sex"),
|
| 29 |
-
gr.Radio(["HIGH", "LOW", "NORMAL"], label="Blood Pressure"),
|
| 30 |
-
gr.Radio(["HIGH", "NORMAL"], label="Cholesterol"),
|
| 31 |
-
gr.Slider(6.2, 38.2, step=0.1, label="Na_to_K"),
|
| 32 |
-
]
|
| 33 |
-
outputs = gr.Label() # Jeśli chcesz tylko label jako tekst
|
| 34 |
-
|
| 35 |
-
examples = [
|
| 36 |
-
[30, "M", "HIGH", "NORMAL", 15.4],
|
| 37 |
-
[35, "F", "LOW", "NORMAL", 8],
|
| 38 |
-
[50, "M", "HIGH", "HIGH", 34],
|
| 39 |
-
]
|
| 40 |
-
|
| 41 |
-
title = "Drug Classification"
|
| 42 |
-
description = "Enter the details to correctly identify Drug type?"
|
| 43 |
-
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."
|
| 44 |
-
|
| 45 |
-
gr.Interface(
|
| 46 |
-
fn=predict_drug,
|
| 47 |
-
inputs=inputs,
|
| 48 |
-
outputs=outputs,
|
| 49 |
-
examples=examples,
|
| 50 |
-
title=title,
|
| 51 |
-
description=description,
|
| 52 |
-
article=article,
|
| 53 |
-
theme=gr.themes.Soft(),
|
| 54 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|