bearking58 commited on
Commit
0729a48
·
1 Parent(s): 9527577

fix: type issues on the final json output

Browse files
cloudbuild.yaml CHANGED
@@ -6,6 +6,7 @@ steps:
6
  automapSubstitutions: true
7
 
8
  - name: "gcr.io/cloud-builders/docker"
 
9
  script: |
10
  docker push us-central1-docker.pkg.dev/${PROJECT_ID}/interview-ai-detector/model-prediction:latest
11
  automapSubstitutions: true
@@ -38,6 +39,8 @@ steps:
38
 
39
  - name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
40
  entrypoint: "bash"
 
 
41
  args:
42
  - "-c"
43
  - |
 
6
  automapSubstitutions: true
7
 
8
  - name: "gcr.io/cloud-builders/docker"
9
+ id: "push-image"
10
  script: |
11
  docker push us-central1-docker.pkg.dev/${PROJECT_ID}/interview-ai-detector/model-prediction:latest
12
  automapSubstitutions: true
 
39
 
40
  - name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
41
  entrypoint: "bash"
42
+ waitFor:
43
+ - "push-image"
44
  args:
45
  - "-c"
46
  - |
core-model-prediction/prediction.py CHANGED
@@ -64,7 +64,7 @@ def process_instance(data: PredictRequest):
64
  return {
65
  "prediction_class": "AI" if secondary_model_prediction == 1 else "HUMAN",
66
  "details": {
67
- "main_model_probability": main_model_probability,
68
  "final_prediction": secondary_model_prediction
69
  }
70
  }
 
64
  return {
65
  "prediction_class": "AI" if secondary_model_prediction == 1 else "HUMAN",
66
  "details": {
67
+ "main_model_probability": str(main_model_probability),
68
  "final_prediction": secondary_model_prediction
69
  }
70
  }
core-model-prediction/random_forest_model.py CHANGED
@@ -12,4 +12,4 @@ class RandomForestModel:
12
  return self.scaler.transform(np.array(secondary_model_features).astype(np.float32).reshape(1, -1))
13
 
14
  def predict(self, secondary_model_features: List[float]):
15
- return self.model.predict(self.preprocess_input(secondary_model_features))[0]
 
12
  return self.scaler.transform(np.array(secondary_model_features).astype(np.float32).reshape(1, -1))
13
 
14
  def predict(self, secondary_model_features: List[float]):
15
+ return int(self.model.predict(self.preprocess_input(secondary_model_features))[0])