Upload app.py
Browse files
app.py
CHANGED
@@ -10,12 +10,12 @@ import pandas as pd
|
|
10 |
from huggingface_hub import CommitScheduler
|
11 |
from pathlib import Path
|
12 |
|
13 |
-
|
|
|
14 |
|
15 |
-
# Run the training script
|
16 |
-
#
|
17 |
-
#
|
18 |
-
#print('done!')
|
19 |
|
20 |
# Configure the logging functionality
|
21 |
log_file = Path("logs/") / f"data_{uuid.uuid4()}.json"
|
@@ -59,11 +59,13 @@ model_output = gr.Label(label="charges")
|
|
59 |
|
60 |
def predict_insurance_charges(age, bmi, children, sex, smoker, region):
|
61 |
|
|
|
|
|
62 |
sample = {
|
63 |
'age': age,
|
|
|
64 |
'bmi': bmi,
|
65 |
'children': children,
|
66 |
-
'sex': sex,
|
67 |
'smoker': smoker,
|
68 |
'region': region
|
69 |
}
|
@@ -76,17 +78,17 @@ def predict_insurance_charges(age, bmi, children, sex, smoker, region):
|
|
76 |
with log_file.open("a") as f:
|
77 |
f.write(json.dumps(
|
78 |
{
|
79 |
-
'
|
80 |
-
'
|
81 |
-
'
|
82 |
-
'
|
83 |
-
'
|
84 |
-
'
|
85 |
'prediction': prediction[0]
|
86 |
}
|
87 |
))
|
88 |
f.write("\n")
|
89 |
-
|
90 |
return prediction[0]
|
91 |
|
92 |
gr_interface = gr.Interface(
|
@@ -106,6 +108,3 @@ gr_interface = gr.Interface(
|
|
106 |
|
107 |
gr_interface.queue()
|
108 |
gr_interface.launch(share=False)
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
10 |
from huggingface_hub import CommitScheduler
|
11 |
from pathlib import Path
|
12 |
|
13 |
+
# print('*** Running train.py ***')
|
14 |
+
# import subprocess
|
15 |
|
16 |
+
# # Run the training script
|
17 |
+
# subprocess.run(["python", "train.py"])
|
18 |
+
# print('*** done! ***')
|
|
|
19 |
|
20 |
# Configure the logging functionality
|
21 |
log_file = Path("logs/") / f"data_{uuid.uuid4()}.json"
|
|
|
59 |
|
60 |
def predict_insurance_charges(age, bmi, children, sex, smoker, region):
|
61 |
|
62 |
+
#Index(['age', 'sex', 'bmi', 'children', 'smoker', 'region'], dtype='object')
|
63 |
+
|
64 |
sample = {
|
65 |
'age': age,
|
66 |
+
'sex': sex,
|
67 |
'bmi': bmi,
|
68 |
'children': children,
|
|
|
69 |
'smoker': smoker,
|
70 |
'region': region
|
71 |
}
|
|
|
78 |
with log_file.open("a") as f:
|
79 |
f.write(json.dumps(
|
80 |
{
|
81 |
+
'age': age,
|
82 |
+
'sex': sex,
|
83 |
+
'bmi': bmi,
|
84 |
+
'children': children,
|
85 |
+
'smoker': smoker,
|
86 |
+
'region': region,
|
87 |
'prediction': prediction[0]
|
88 |
}
|
89 |
))
|
90 |
f.write("\n")
|
91 |
+
|
92 |
return prediction[0]
|
93 |
|
94 |
gr_interface = gr.Interface(
|
|
|
108 |
|
109 |
gr_interface.queue()
|
110 |
gr_interface.launch(share=False)
|
|
|
|
|
|