Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ scikit-learn==1.0.2
scipy==1.8.0
six==1.16.0
threadpoolctl==3.1.0
Flask==3.0.1
flask_cors==5.0.0
Binary file added src/__pycache__/api.cpython-310.pyc
Binary file not shown.
27 changes: 27 additions & 0 deletions src/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

from flask import Flask, Response
from flask_cors import CORS
import pandas as pd

app = Flask(__name__)

CORS(app)


training_data = pd.read_csv(os.path.join("data", "auto-mpg.csv"))


@app.route("/", methods=["GET"])
def index():
return {"hello": "world"}


@app.route("/hello_world", methods=["GET"])
def hello_world():
return "<p>Hello World!</p>"


@app.route("/training_data", methods=["GET"])
def get_training_data():
return Response(training_data.to_json(), mimetype="application/json")
5 changes: 5 additions & 0 deletions wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from src.api import app


if __name__ == "__main__":
app.run(debug=True)