Skip to content

Commit

Permalink
Merge pull request #4 from CMU-17313Q/career-feature
Browse files Browse the repository at this point in the history
Integration of ML-Based Career Feature Microservice
  • Loading branch information
Maria-Aidarus authored Nov 12, 2023
2 parents 3c9bcb4 + 9b1157d commit 6f15545
Show file tree
Hide file tree
Showing 21 changed files with 813 additions and 41 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ test/files
/public/src/modules/ace-editor.js
/public/src/client/account/header.js
/public/src/client/test.js
themes/
themes/
career-model/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ theme/*.sublime-workspace
theme/.idea
theme/.vscode
theme/node_modules/


# Career Model: Python Ignores
__pycache__
21 changes: 21 additions & 0 deletions career-model/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.11

WORKDIR /career-model

# Install any additional dependencies
COPY requirements.txt .

RUN pip install flask
RUN pip install --no-cache-dir -r requirements.txt

COPY . .



EXPOSE 8080

ENV PORT 8080

ENV HOSTNAME "0.0.0.0"

CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8080"]
40 changes: 40 additions & 0 deletions career-model/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from flask import Flask, request

from predict import predict

app = Flask(__name__)

@app.route("/")
def hello_world():
return "<p>NodeBB!</p>"

@app.route("/predict", methods=["GET"])
def predict_student():
# Get parameters from the URL query string
student_id = request.args.get("student_id")
gender = request.args.get("gender")
age = request.args.get("age")
major = request.args.get("major")
gpa = request.args.get("gpa")
extra_curricular = request.args.get("extra_curricular")
num_programming_languages = request.args.get("num_programming_languages")
num_past_internships = request.args.get("num_past_internships")

# Create a dictionary with the input parameters
student = {
"student_id": student_id,
"gender": gender,
"age": age,
"major": major,
"gpa": gpa,
"extra_curricular": extra_curricular,
"num_programming_languages": num_programming_languages,
"num_past_internships": num_past_internships
}

# Call the predict function to get the prediction
prediction_result = predict(student)
# Convert 'int64' to 'int' for JSON serialization
prediction_result['good_employee'] = int(prediction_result['good_employee'])

return prediction_result
Loading

0 comments on commit 6f15545

Please sign in to comment.