Skip to content
Open
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Dev-Sec-Ops Demo/Assignment

[![codecov](https://codecov.io/gh/PGCSEDS-IIITH/devsecops-iris/branch/master/graph/badge.svg?token=EILEH8L7R5)](https://codecov.io/gh/PGCSEDS-IIITH/devsecops-iris)
[![codecov](https://app.codecov.io/gh/kgvrmohan26/devsecops-iris/branch/master/graph/badge.svg?token=EILEH8L7R5)](https://app.codecov.io/gh/kgvrmohan26/devsecops-iris)

This repository contains code which demonstrates Dev-Sec-Ops using a `FastAPI` application which predicts the flower class using the IRIS dataset (https://scikit-learn.org/stable/auto_examples/datasets/plot_iris_dataset.html)
This repository contains code which demonstrates Dev-Sec-Ops using a `FastAPI` application which predicts the flower class using the IRIS dataset (https://scikit-learn.org/stable/auto_examples/datasets/plot_iris_dataset.html).

## Running Instructions
- Create a fork of the repo using the `fork` button.
- Clone your fork using `git clone https://www.github.com/<your-username>/mlops-iris.git`
- Clone your fork using `git clone https://github.com/kgvrmohan26/devsecops-iris.git`..
- Install dependencies using `pip3 install -r requirements.txt`
- Run application using `python3 main.py`
- Run tests using `pytest`
Expand All @@ -25,4 +25,4 @@ This repository contains code which demonstrates Dev-Sec-Ops using a `FastAPI` a
- Make a visualisation for sarif report using any tool. upload screenshot, image, html or pdf. Add it to the reports/ folder.

## Submission
- Link to github repository as a comment on the submission (olympus portal). [uploading .txt is optional]
- Link to github repository as a comment on the submission (olympus portal). [uploading .txt is optional]
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FeedbackIn(BaseModel):
sepal_width: float
petal_length: float
petal_width: float
flower_class: str
flower_class: str='Iris Setosa'


# Route definitions
Expand Down
16 changes: 16 additions & 0 deletions test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,19 @@ def test_pred_virginica():
# asserting the correct response is received
assert response.status_code == 200
assert response.json() == {"flower_class": "Iris Virginica"}

# test to check if Iris Virginica is classified correctly
def test_retrain():
# defining a sample payload for the testcase
payload = {
"sepal_length": 0,
"sepal_width": 0,
"petal_length": 0,
"petal_width": 0,
"flower_class": 'Iris Setosa'
}
with TestClient(app) as client:
response = client.post("/feedback_loop", json=payload)
# asserting the correct response is received
#assert response.status_code == 200
#assert response.json() == {"flower_class": "Iris Virginica"}