Spaces:
Running
Running
fix layout
Browse files- Pipfile +1 -0
- Pipfile.lock +11 -2
- app.py +170 -155
Pipfile
CHANGED
|
@@ -8,6 +8,7 @@ gradio = "*"
|
|
| 8 |
pandas = "*"
|
| 9 |
joblib = "*"
|
| 10 |
scikit-learn = "*"
|
|
|
|
| 11 |
|
| 12 |
[dev-packages]
|
| 13 |
|
|
|
|
| 8 |
pandas = "*"
|
| 9 |
joblib = "*"
|
| 10 |
scikit-learn = "*"
|
| 11 |
+
gradio-modal = "*"
|
| 12 |
|
| 13 |
[dev-packages]
|
| 14 |
|
Pipfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"_meta": {
|
| 3 |
"hash": {
|
| 4 |
-
"sha256": "
|
| 5 |
},
|
| 6 |
"pipfile-spec": 6,
|
| 7 |
"requires": {
|
|
@@ -336,6 +336,15 @@
|
|
| 336 |
"markers": "python_version >= '3.8'",
|
| 337 |
"version": "==0.10.0"
|
| 338 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
"h11": {
|
| 340 |
"hashes": [
|
| 341 |
"sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d",
|
|
@@ -682,7 +691,7 @@
|
|
| 682 |
"sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3",
|
| 683 |
"sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f"
|
| 684 |
],
|
| 685 |
-
"markers": "python_version
|
| 686 |
"version": "==1.26.4"
|
| 687 |
},
|
| 688 |
"orjson": {
|
|
|
|
| 1 |
{
|
| 2 |
"_meta": {
|
| 3 |
"hash": {
|
| 4 |
+
"sha256": "0ed8c82d608eb519e9f57cd59ed5f9ce206291a090c6a4059304804af74e1d1f"
|
| 5 |
},
|
| 6 |
"pipfile-spec": 6,
|
| 7 |
"requires": {
|
|
|
|
| 336 |
"markers": "python_version >= '3.8'",
|
| 337 |
"version": "==0.10.0"
|
| 338 |
},
|
| 339 |
+
"gradio-modal": {
|
| 340 |
+
"hashes": [
|
| 341 |
+
"sha256:7fb1b30dd967e5d64251b763afc922e189f24cadc1ae428126575c26cdd42b83",
|
| 342 |
+
"sha256:83c40586b4e85bb78efd0871a2c1b8aca6b7af4547a23b1f575c6226818f4bf1"
|
| 343 |
+
],
|
| 344 |
+
"index": "pypi",
|
| 345 |
+
"markers": "python_version >= '3.8'",
|
| 346 |
+
"version": "==0.0.2"
|
| 347 |
+
},
|
| 348 |
"h11": {
|
| 349 |
"hashes": [
|
| 350 |
"sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d",
|
|
|
|
| 691 |
"sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3",
|
| 692 |
"sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f"
|
| 693 |
],
|
| 694 |
+
"markers": "python_version >= '3.9'",
|
| 695 |
"version": "==1.26.4"
|
| 696 |
},
|
| 697 |
"orjson": {
|
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import pandas as pd
|
| 2 |
import gradio as gr
|
| 3 |
import joblib
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
# Inputs for UI
|
|
@@ -113,14 +114,12 @@ def call_the_model(
|
|
| 113 |
}
|
| 114 |
input_df = pd.DataFrame(data)
|
| 115 |
|
| 116 |
-
# print(df)
|
| 117 |
-
# res = MODEL.predict(input_df)
|
| 118 |
prob = MODEL.predict_proba(input_df)
|
| 119 |
no, yes = prob[0]
|
| 120 |
if no > yes:
|
| 121 |
return f"The client is {round(no * 100)}% likely to relapse."
|
| 122 |
else:
|
| 123 |
-
return f"The client is {round(yes * 100)}% likely to
|
| 124 |
|
| 125 |
|
| 126 |
def inference(age: gr.Number, race: gr.Dropdown):
|
|
@@ -133,159 +132,175 @@ with gr.Blocks(
|
|
| 133 |
neutral_hue=gr.themes.colors.slate,
|
| 134 |
)
|
| 135 |
) as demo:
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
"Other stimulants: Includes methylphenidate and any other stimulants",
|
| 214 |
-
"Benzodiazepines: Includes alprazolam, chlordiazepoxide, clonazepam, clorazepate, diazepam, flunitrazepam,flurazepam, halazepam, lorazepam, oxazepam, prazepam, temazepam, triazolam, and other unspecified benzodiazepines",
|
| 215 |
-
"Other tranquilizers: Includes meprobamate, and other non-benzodiazepine tranquilizers",
|
| 216 |
-
"Barbiturates: Includes amobarbital, pentobarbital, phenobarbital, secobarbital, etc.",
|
| 217 |
-
"Other sedatives or hypnotics: Includes chloral hydrate, ethchlorvynol, glutethimide, methaqualone, and othernon-barbiturate sedatives and hypnotics",
|
| 218 |
-
"Inhalants: Includes aerosols; chloroform, ether, nitrous oxide and other anesthetics; gasoline; glue; nitrites; paint thinnerand other solvents; and other inappropriately inhaled products",
|
| 219 |
-
"Over-the-counter medications: Includes aspirin, dextromethorphan and other cough syrups, diphenhydramine and otheranti-histamines, ephedrine, sleep aids, and any other legally obtained, non-prescription medication",
|
| 220 |
-
"Other drugs: Includes diphenylhydantoin/phenytoin, GHB/GBL, ketamine, synthetic cannabinoid 'Spice', carisoprodol(Soma), and other drugs",
|
| 221 |
-
],
|
| 222 |
-
label="Primary Substance Use",
|
| 223 |
-
info="Client's primary substance use at admission",
|
| 224 |
-
type="index",
|
| 225 |
-
value=0,
|
| 226 |
-
)
|
| 227 |
-
first_use = gr.Number(
|
| 228 |
-
label="Age at First Use of Primary Substance",
|
| 229 |
-
info="For alcohol use, this is the age of first intoxication",
|
| 230 |
-
minimum=0,
|
| 231 |
-
maximum=100,
|
| 232 |
-
value=25,
|
| 233 |
-
)
|
| 234 |
-
frequency = gr.Radio(
|
| 235 |
-
["No use in the past month", "Some use", "Daily use"],
|
| 236 |
-
label="Frequency of Primary Substance Use",
|
| 237 |
-
type="index",
|
| 238 |
-
value="No use in the past month",
|
| 239 |
-
)
|
| 240 |
-
days_waiting = gr.Number(
|
| 241 |
-
label="Days Waiting to Enter Substance Use Treatment",
|
| 242 |
-
info="Number of days from the first contact or request for substance use treatment service until the client was admitted and the first clinical substance use treatment service was provided",
|
| 243 |
-
minimum=0,
|
| 244 |
-
)
|
| 245 |
-
arrests = gr.Radio(
|
| 246 |
-
["None", "Once", "Two or more times"],
|
| 247 |
-
label="Arrests",
|
| 248 |
-
info="Number of arrests in the 30 days prior to admission",
|
| 249 |
-
type="index",
|
| 250 |
-
value="None",
|
| 251 |
-
)
|
| 252 |
-
attendance = gr.Dropdown(
|
| 253 |
-
[
|
| 254 |
-
"No attendance",
|
| 255 |
-
"1-3 times in the past month",
|
| 256 |
-
"4-7 times in the past month",
|
| 257 |
-
"8-30 times in the past month",
|
| 258 |
-
"Some attendance, frequency is unknown",
|
| 259 |
-
],
|
| 260 |
-
label="Attendance at Substance Use Self-help Groups in Past 30 Days",
|
| 261 |
-
info="Frequency of attendance at a substance use self-help group in the 30 days prior to the reference date (the date of admission). Includes Alcoholics Anonymous (AA), Narcotics Anonymous (NA), and other self-help/mutual support groups focused on recovery from substance use and dependence",
|
| 262 |
-
type="index",
|
| 263 |
-
value=0,
|
| 264 |
-
)
|
| 265 |
-
services = gr.Dropdown(
|
| 266 |
-
[
|
| 267 |
-
"Detox, 24-hour, hospital inpatient",
|
| 268 |
-
"Detox, 24-hour, free-standing residential",
|
| 269 |
-
"Rehab/residential, hospital (non-detox)",
|
| 270 |
-
"Rehab/residential, short term (30 days or fewer)",
|
| 271 |
-
"Rehab/residential, long term (more than 30 days)",
|
| 272 |
-
"Ambulatory, intensive outpatient",
|
| 273 |
-
"Ambulatory, non-intensive outpatient",
|
| 274 |
-
"Ambulatory, detoxification",
|
| 275 |
-
],
|
| 276 |
-
label="Type of Treatment Service/Setting",
|
| 277 |
-
info="Type of treatment service or treatment setting in which the client is placed at the time of admission or transfer",
|
| 278 |
-
type="index",
|
| 279 |
-
value=0,
|
| 280 |
-
)
|
| 281 |
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
|
| 286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
|
| 288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
submit_btn.click(
|
| 291 |
call_the_model,
|
|
@@ -305,8 +320,8 @@ with gr.Blocks(
|
|
| 305 |
services,
|
| 306 |
co_occuring,
|
| 307 |
],
|
| 308 |
-
[
|
| 309 |
-
)
|
| 310 |
|
| 311 |
|
| 312 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
import gradio as gr
|
| 3 |
import joblib
|
| 4 |
+
from gradio_modal import Modal
|
| 5 |
|
| 6 |
|
| 7 |
# Inputs for UI
|
|
|
|
| 114 |
}
|
| 115 |
input_df = pd.DataFrame(data)
|
| 116 |
|
|
|
|
|
|
|
| 117 |
prob = MODEL.predict_proba(input_df)
|
| 118 |
no, yes = prob[0]
|
| 119 |
if no > yes:
|
| 120 |
return f"The client is {round(no * 100)}% likely to relapse."
|
| 121 |
else:
|
| 122 |
+
return f"The client is {round(yes * 100)}% likely to not relapse."
|
| 123 |
|
| 124 |
|
| 125 |
def inference(age: gr.Number, race: gr.Dropdown):
|
|
|
|
| 132 |
neutral_hue=gr.themes.colors.slate,
|
| 133 |
)
|
| 134 |
) as demo:
|
| 135 |
+
title = gr.Markdown("# NoLapse: Substance Use Relapse Prediction")
|
| 136 |
+
with gr.Row():
|
| 137 |
+
with gr.Column():
|
| 138 |
+
age = gr.Number(
|
| 139 |
+
label="Age",
|
| 140 |
+
info="Age of client at admission",
|
| 141 |
+
minimum=0,
|
| 142 |
+
maximum=100,
|
| 143 |
+
value=25,
|
| 144 |
+
)
|
| 145 |
+
race = gr.Dropdown(
|
| 146 |
+
[
|
| 147 |
+
"Alaska Native (Aleut, Eskimo, Indian)",
|
| 148 |
+
"American Indian (other than Alaska Native)",
|
| 149 |
+
"Asian or Pacific Islander",
|
| 150 |
+
"Black or African American",
|
| 151 |
+
"White",
|
| 152 |
+
"Asian",
|
| 153 |
+
"Other single race",
|
| 154 |
+
"Two or more races",
|
| 155 |
+
"Native Hawaiian or Other Pacific Islander",
|
| 156 |
+
],
|
| 157 |
+
label="Race",
|
| 158 |
+
type="index",
|
| 159 |
+
value=0,
|
| 160 |
+
)
|
| 161 |
+
education = gr.Dropdown(
|
| 162 |
+
[
|
| 163 |
+
"Less than one school grade, no schooling, nursery school, or kindergarten to Grade 8",
|
| 164 |
+
"Grades 9 to 11",
|
| 165 |
+
"Grade 12 (or GED)",
|
| 166 |
+
"1-3 years of college, university, or vocational school",
|
| 167 |
+
"4 years of college, university, BA/BS, some postgraduate study, or more",
|
| 168 |
+
],
|
| 169 |
+
label="Education",
|
| 170 |
+
info="The highest school grade completed for adults or children not attending school, or current school grade for school-age children (3-17 years old) attending school",
|
| 171 |
+
type="index",
|
| 172 |
+
value=0,
|
| 173 |
+
)
|
| 174 |
+
marital = gr.Dropdown(
|
| 175 |
+
["Never married", "Now married", "Separated", "Divorced, widowed"],
|
| 176 |
+
label="Marital Status",
|
| 177 |
+
info="Client's marital status, compatible with U.S. Census categories",
|
| 178 |
+
type="index",
|
| 179 |
+
value=0,
|
| 180 |
+
)
|
| 181 |
+
primary_income = gr.Dropdown(
|
| 182 |
+
[
|
| 183 |
+
"Wages/salary",
|
| 184 |
+
"Public assistance",
|
| 185 |
+
"Retirement/pension, disability",
|
| 186 |
+
"Other",
|
| 187 |
+
"None",
|
| 188 |
+
],
|
| 189 |
+
label="Primary Source of Income/Support",
|
| 190 |
+
info="Client's principal source of financial support (for children younger than 18 years old, the primary parental source of income/support)",
|
| 191 |
+
type="index",
|
| 192 |
+
value=0,
|
| 193 |
+
)
|
| 194 |
+
health_insurance = gr.Dropdown(
|
| 195 |
+
[
|
| 196 |
+
"Private insurance, Blue Cross/Blue Shield, HMO",
|
| 197 |
+
"Medicaid",
|
| 198 |
+
"Medicare, other (e.g. TRICARE, CHAMPUS)",
|
| 199 |
+
"None",
|
| 200 |
+
],
|
| 201 |
+
label="Health Insurance",
|
| 202 |
+
info="Client's health insurance at admission",
|
| 203 |
+
type="index",
|
| 204 |
+
value=0,
|
| 205 |
+
)
|
| 206 |
+
frequency = gr.Radio(
|
| 207 |
+
["No use in the past month", "Some use", "Daily use"],
|
| 208 |
+
label="Frequency of Primary Substance Use",
|
| 209 |
+
type="index",
|
| 210 |
+
value="No use in the past month",
|
| 211 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
|
| 213 |
+
with gr.Column():
|
| 214 |
+
primary_substance = gr.Dropdown(
|
| 215 |
+
[
|
| 216 |
+
"None",
|
| 217 |
+
"Alcohol",
|
| 218 |
+
"Cocaine/crack",
|
| 219 |
+
"Marijuana/hashish: Includes THC and any other cannabis sativa preparations",
|
| 220 |
+
"Heroin",
|
| 221 |
+
"Non-prescription methadone",
|
| 222 |
+
"Other opiates and synthetics: Includes buprenorphine, butorphanol, codeine, hydrocodone, hydromorphone, meperidine,morphine, opium, oxycodone, pentazocine, propoxyphene, tramadol, and other narcotic analgesics, opiates, or synthetics",
|
| 223 |
+
"PCP: Phencyclidine",
|
| 224 |
+
"Hallucinogens: Includes LSD, DMT, mescaline, peyote, psilocybin, STP, and other hallucinogens",
|
| 225 |
+
"Methamphetamine/speed",
|
| 226 |
+
"Other amphetamines: Includes amphetamines, MDMA, ‘bath salts’, phenmetrazine, and other amines and related drugs",
|
| 227 |
+
"Other stimulants: Includes methylphenidate and any other stimulants",
|
| 228 |
+
"Benzodiazepines: Includes alprazolam, chlordiazepoxide, clonazepam, clorazepate, diazepam, flunitrazepam,flurazepam, halazepam, lorazepam, oxazepam, prazepam, temazepam, triazolam, and other unspecified benzodiazepines",
|
| 229 |
+
"Other tranquilizers: Includes meprobamate, and other non-benzodiazepine tranquilizers",
|
| 230 |
+
"Barbiturates: Includes amobarbital, pentobarbital, phenobarbital, secobarbital, etc.",
|
| 231 |
+
"Other sedatives or hypnotics: Includes chloral hydrate, ethchlorvynol, glutethimide, methaqualone, and othernon-barbiturate sedatives and hypnotics",
|
| 232 |
+
"Inhalants: Includes aerosols; chloroform, ether, nitrous oxide and other anesthetics; gasoline; glue; nitrites; paint thinnerand other solvents; and other inappropriately inhaled products",
|
| 233 |
+
"Over-the-counter medications: Includes aspirin, dextromethorphan and other cough syrups, diphenhydramine and otheranti-histamines, ephedrine, sleep aids, and any other legally obtained, non-prescription medication",
|
| 234 |
+
"Other drugs: Includes diphenylhydantoin/phenytoin, GHB/GBL, ketamine, synthetic cannabinoid 'Spice', carisoprodol(Soma), and other drugs",
|
| 235 |
+
],
|
| 236 |
+
label="Primary Substance Use",
|
| 237 |
+
info="Client's primary substance use at admission",
|
| 238 |
+
type="index",
|
| 239 |
+
value=0,
|
| 240 |
+
)
|
| 241 |
|
| 242 |
+
first_use = gr.Number(
|
| 243 |
+
label="Age at First Use of Primary Substance",
|
| 244 |
+
info="For alcohol use, this is the age of first intoxication",
|
| 245 |
+
minimum=0,
|
| 246 |
+
maximum=100,
|
| 247 |
+
value=25,
|
| 248 |
+
)
|
| 249 |
|
| 250 |
+
days_waiting = gr.Number(
|
| 251 |
+
label="Days Waiting to Enter Substance Use Treatment",
|
| 252 |
+
info="Number of days from the first contact or request for substance use treatment service until the client was admitted and the first clinical substance use treatment service was provided",
|
| 253 |
+
minimum=0,
|
| 254 |
+
)
|
| 255 |
+
arrests = gr.Radio(
|
| 256 |
+
["None", "Once", "Two or more times"],
|
| 257 |
+
label="Arrests",
|
| 258 |
+
info="Number of arrests in the 30 days prior to admission",
|
| 259 |
+
type="index",
|
| 260 |
+
value="None",
|
| 261 |
+
)
|
| 262 |
+
attendance = gr.Dropdown(
|
| 263 |
+
[
|
| 264 |
+
"No attendance",
|
| 265 |
+
"1-3 times in the past month",
|
| 266 |
+
"4-7 times in the past month",
|
| 267 |
+
"8-30 times in the past month",
|
| 268 |
+
"Some attendance, frequency is unknown",
|
| 269 |
+
],
|
| 270 |
+
label="Attendance at Substance Use Self-help Groups in Past 30 Days",
|
| 271 |
+
info="Frequency of attendance at a substance use self-help group in the 30 days prior to the reference date (the date of admission). Includes Alcoholics Anonymous (AA), Narcotics Anonymous (NA), and other self-help/mutual support groups focused on recovery from substance use and dependence",
|
| 272 |
+
type="index",
|
| 273 |
+
value=0,
|
| 274 |
+
)
|
| 275 |
+
services = gr.Dropdown(
|
| 276 |
+
[
|
| 277 |
+
"Detox, 24-hour, hospital inpatient",
|
| 278 |
+
"Detox, 24-hour, free-standing residential",
|
| 279 |
+
"Rehab/residential, hospital (non-detox)",
|
| 280 |
+
"Rehab/residential, short term (30 days or fewer)",
|
| 281 |
+
"Rehab/residential, long term (more than 30 days)",
|
| 282 |
+
"Ambulatory, intensive outpatient",
|
| 283 |
+
"Ambulatory, non-intensive outpatient",
|
| 284 |
+
"Ambulatory, detoxification",
|
| 285 |
+
],
|
| 286 |
+
label="Type of Treatment Service/Setting",
|
| 287 |
+
info="Type of treatment service or treatment setting in which the client is placed at the time of admission or transfer",
|
| 288 |
+
type="index",
|
| 289 |
+
value=0,
|
| 290 |
+
)
|
| 291 |
+
|
| 292 |
+
co_occuring = gr.Checkbox(
|
| 293 |
+
value=False, label="Co-occurring Mental and Substance Use Disorders"
|
| 294 |
+
)
|
| 295 |
+
|
| 296 |
+
submit_btn = gr.Button("SUBMIT", variant="primary", size="lg")
|
| 297 |
+
|
| 298 |
+
# result = gr.Label(label="Result")
|
| 299 |
+
with Modal(visible=False) as modal:
|
| 300 |
+
modal_content = gr.Label(show_label=False)
|
| 301 |
+
disclaimer = gr.Markdown(
|
| 302 |
+
"###### The accuracy of this model is 74%. Take results with caution."
|
| 303 |
+
)
|
| 304 |
|
| 305 |
submit_btn.click(
|
| 306 |
call_the_model,
|
|
|
|
| 320 |
services,
|
| 321 |
co_occuring,
|
| 322 |
],
|
| 323 |
+
[modal_content],
|
| 324 |
+
).then(lambda: Modal(visible=True), None, modal)
|
| 325 |
|
| 326 |
|
| 327 |
if __name__ == "__main__":
|