generated from CMU-17313Q/NodeBB-f23
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from CMU-17313Q/career-feature
Integration of ML-Based Career Feature Microservice
- Loading branch information
Showing
21 changed files
with
813 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.