Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,8 @@ import numpy as np
|
|
13 |
import io
|
14 |
import pickle
|
15 |
import requests
|
16 |
-
|
|
|
17 |
|
18 |
url = 'https://raw.githubusercontent.com/fmegahed/tavr_paper/main/data/example_data2.csv'
|
19 |
download = requests.get(url).content
|
@@ -34,10 +35,11 @@ def predict(age, female, race, elective, aweekend, zipinc_qrtl, hosp_region, hos
|
|
34 |
pulmonary_circulation_disorder, smoker, valvular_disease, weight_loss,
|
35 |
endovascular_tavr, transapical_tavr):
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
41 |
|
42 |
df = pd.DataFrame.from_dict({
|
43 |
'age': [age], 'female': [female], 'race': [race], 'elective': elective,
|
|
|
13 |
import io
|
14 |
import pickle
|
15 |
import requests
|
16 |
+
import urllib.request
|
17 |
+
import shutil
|
18 |
|
19 |
url = 'https://raw.githubusercontent.com/fmegahed/tavr_paper/main/data/example_data2.csv'
|
20 |
download = requests.get(url).content
|
|
|
35 |
pulmonary_circulation_disorder, smoker, valvular_disease, weight_loss,
|
36 |
endovascular_tavr, transapical_tavr):
|
37 |
|
38 |
+
with urllib.request.urlopen('https://github.com/fmegahed/tavr_paper/blob/main/data/final_model.pkl?raw=true') as response,
|
39 |
+
open('final_model.pkl', 'wb') as out_file:
|
40 |
+
shutil.copyfileobj(response, out_file)
|
41 |
+
|
42 |
+
model = load_model('final_model')
|
43 |
|
44 |
df = pd.DataFrame.from_dict({
|
45 |
'age': [age], 'female': [female], 'race': [race], 'elective': elective,
|