Spaces:
Build error
Build error
Commit
·
f9846ff
1
Parent(s):
c504867
updating requirements.txt and cleaning things up. Thought it would be working but for some reason requests from postman are not making it to the api
Browse files- app.py +3 -7
- neural_network/neural_network.py +0 -1
- requirements.txt +1 -3
app.py
CHANGED
|
@@ -28,6 +28,7 @@ def not_valid(params: dict):
|
|
| 28 |
@app.route("/", methods=["GET"])
|
| 29 |
def index():
|
| 30 |
params = request.json
|
|
|
|
| 31 |
error_message = not_valid(params=params)
|
| 32 |
if error_message:
|
| 33 |
return make_response(error_message, 400)
|
|
@@ -39,13 +40,8 @@ def index():
|
|
| 39 |
# in the future instead of a random data set
|
| 40 |
# we should do a more real one like palmer penguins
|
| 41 |
X, y = random_dataset(100, 10)
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
X=X,
|
| 45 |
-
y=y,
|
| 46 |
-
args=args,
|
| 47 |
-
)
|
| 48 |
-
)
|
| 49 |
|
| 50 |
|
| 51 |
if __name__ == '__main__':
|
|
|
|
| 28 |
@app.route("/", methods=["GET"])
|
| 29 |
def index():
|
| 30 |
params = request.json
|
| 31 |
+
print(params)
|
| 32 |
error_message = not_valid(params=params)
|
| 33 |
if error_message:
|
| 34 |
return make_response(error_message, 400)
|
|
|
|
| 40 |
# in the future instead of a random data set
|
| 41 |
# we should do a more real one like palmer penguins
|
| 42 |
X, y = random_dataset(100, 10)
|
| 43 |
+
model = algorithm(X, y, args)
|
| 44 |
+
return jsonify(model)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
if __name__ == '__main__':
|
neural_network/neural_network.py
CHANGED
|
@@ -25,7 +25,6 @@ class NeuralNetwork:
|
|
| 25 |
return self.compute_node(n1, self.w2, self.b2, self.activation_func)
|
| 26 |
|
| 27 |
def set_loss_hist(self, loss_hist: list) -> None:
|
| 28 |
-
assert (isinstance(loss_hist, list))
|
| 29 |
self.loss_history = loss_hist
|
| 30 |
|
| 31 |
def eval(self, X_test, y_test) -> None:
|
|
|
|
| 25 |
return self.compute_node(n1, self.w2, self.b2, self.activation_func)
|
| 26 |
|
| 27 |
def set_loss_hist(self, loss_hist: list) -> None:
|
|
|
|
| 28 |
self.loss_history = loss_hist
|
| 29 |
|
| 30 |
def eval(self, X_test, y_test) -> None:
|
requirements.txt
CHANGED
|
@@ -2,7 +2,5 @@ Flask==2.2.3
|
|
| 2 |
gunicorn==20.1.0
|
| 3 |
|
| 4 |
numpy~=1.24.2
|
| 5 |
-
matplotlib~=3.7.1
|
| 6 |
scikit-learn~=1.2.2
|
| 7 |
-
seaborn~=0.12.2
|
| 8 |
-
tqdm~=4.65.0
|
|
|
|
| 2 |
gunicorn==20.1.0
|
| 3 |
|
| 4 |
numpy~=1.24.2
|
|
|
|
| 5 |
scikit-learn~=1.2.2
|
| 6 |
+
seaborn~=0.12.2
|
|
|