eogreen commited on
Commit
03e66f4
·
verified ·
1 Parent(s): f961b92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -50
app.py CHANGED
@@ -25,64 +25,17 @@ scheduler = CommitScheduler(
25
  every=2
26
  )
27
 
28
- # # Load the saved model
29
- # #insurance_charge_predictor = joblib.load('model.joblib')
30
-
31
- # # Define the input features
32
-
33
- # #numeric_features = ['age', 'bmi', 'children']
34
- # #categorical_features = ['sex', 'smoker', 'region']
35
-
36
- # age_input = gr.Number(label="Age")
37
- # bmi_input = gr.Number(label="BMI")
38
- # children_input = gr.Number(label="Children")
39
-
40
- # # sex: ['female' 'male']
41
- # # smoker: ['yes' 'no']
42
- # # region: ['southwest' 'southeast' 'northwest' 'northeast']
43
-
44
- # sex_input = gr.Dropdown(['female','male'],label='Sex')
45
- # smoker_input = gr.Dropdown(['yes','no'],label='Smoker')
46
- # region_input = gr.Dropdown(['southwest', 'southeast', 'northwest', 'northeast'],label='Region')
47
-
48
- # model_output = gr.Label(label="charges")
49
-
50
- # Define the predict function which will take features, convert to dataframe and make predictions using the saved model
51
- # the functions runs when 'Submit' is clicked or when a API request is made
52
-
53
- def dprocess(age, bmi, children, sex, smoker, region):
54
-
55
- #Index(['age', 'sex', 'bmi', 'children', 'smoker', 'region'], dtype='object')
56
-
57
- # sample = {
58
- # 'age': age,
59
- # 'sex': sex,
60
- # 'bmi': bmi,
61
- # 'children': children,
62
- # 'smoker': smoker,
63
- # 'region': region
64
- # }
65
-
66
- # data_point = pd.DataFrame([sample])
67
-
68
- # prediction = insurance_charge_predictor.predict(data_point).tolist()
69
 
70
  with scheduler.lock:
71
  with log_file.open("a") as f:
72
  f.write(json.dumps(
73
  {
74
- 'age': age,
75
- 'sex': sex,
76
- 'bmi': bmi,
77
- 'children': children,
78
- 'smoker': smoker,
79
- 'region': region,
80
- 'prediction': prediction[0]
81
  }
82
  ))
83
  f.write("\n")
84
 
85
- #return prediction[0]
86
  return 42
87
 
88
  # Set-up the Gradio UI
@@ -101,4 +54,4 @@ demo = gr.Interface(fn=dprocess,
101
  theme=gr.themes.Soft())
102
 
103
  demo.queue()
104
- demo.launch()
 
25
  every=2
26
  )
27
 
28
+ def dprocess(command):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  with scheduler.lock:
31
  with log_file.open("a") as f:
32
  f.write(json.dumps(
33
  {
34
+ 'result': 42
 
 
 
 
 
 
35
  }
36
  ))
37
  f.write("\n")
38
 
 
39
  return 42
40
 
41
  # Set-up the Gradio UI
 
54
  theme=gr.themes.Soft())
55
 
56
  demo.queue()
57
+ demo.launch()