kingabzpro
commited on
Commit
•
8e201b2
1
Parent(s):
527081e
Sync App files
Browse files- drug_app.py +25 -8
drug_app.py
CHANGED
@@ -1,14 +1,31 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
|
|
3 |
|
4 |
-
def greet(name, intensity):
|
5 |
-
return "Hello " * intensity + name + "!"
|
6 |
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
demo = gr.Interface(
|
9 |
-
fn=greet,
|
10 |
-
inputs=["text", "slider"],
|
11 |
-
outputs=["text"],
|
12 |
-
)
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 classifier(Age, Sex, BP, Cholesterol, Na_to_K):
|
8 |
+
pred_glass = pipe.predict([[Age, Sex, BP, Cholesterol, Na_to_K]])[0]
|
9 |
+
label = f"Predicted Glass label: **{pred_glass}**"
|
10 |
+
return label
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
inputs = [
|
14 |
+
gr.Slider(15, 74, step=1, label="Age"),
|
15 |
+
gr.Radio(["M", "F"], label="Sex"),
|
16 |
+
gr.Radio(["HIGH", "LOW", "NORMAL"], label="Blood Pressure"),
|
17 |
+
gr.Radio(["HIGH", "NORMAL"], label="Cholesterol"),
|
18 |
+
gr.Slider(6.2, 38.2, step=0.1, label="Na_to_K"),
|
19 |
+
]
|
20 |
+
outputs = [gr.Label(num_top_classes=5)]
|
21 |
+
|
22 |
+
title = "Drug Classification"
|
23 |
+
description = "Enter the details to correctly identify Drug type?"
|
24 |
+
|
25 |
+
gr.Interface(
|
26 |
+
fn=classifier,
|
27 |
+
inputs=inputs,
|
28 |
+
outputs=outputs,
|
29 |
+
title=title,
|
30 |
+
description=description,
|
31 |
+
).launch()
|