Skip to content

Commit 353be7d

Browse files
Merge pull request #14 from UPstartDeveloper/readme-polish
Readme polish
2 parents ec35558 + 4544881 commit 353be7d

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM python:3.6-slim
22
COPY app/ /app/
3+
COPY classifier/ /classifier/
34
WORKDIR /
45
RUN apt update
56
RUN apt install -y git

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# DeepFire
2+
![This repo has a MIT license](https://img.shields.io/github/license/UPstartDeveloper/Fire-Detection-API)
3+
![Automated tests passing on Travis (.org)](https://img.shields.io/travis/UPstartDeveloper/Fire-Detection-API)
4+
![Docker Image Size (latest)](https://img.shields.io/docker/image-size/zainrazatheupstart/fire-classifier-api/latest?style=flat-square)
25
![Project cover image](https://i.postimg.cc/d1tr9S2H/Screen-Shot-2021-09-02-at-12-37-00-PM.png)
36
An API for detecting fires in images using deep learning.
47

@@ -37,9 +40,10 @@ To run the tests, you will first need to set up a Python virtual environment to
3740
```
3841
(env) $ pytest
3942
```
40-
43+
If there are no failures, then you should be good to go!
44+
You can inspect the code for the tests in `app/main_test.py` if you wish.
4145
## The Data and the Model
42-
The image dataset and model used for the production API will be documented on the [Releases](https://github.com/UPstartDeveloper/Fire-Detection-API/releases) page of this repository.
46+
The image dataset and neural network model used for the production API will be documented on the [Releases](https://github.com/UPstartDeveloper/Fire-Detection-API/releases) page of this repository.
4347

4448
## Making Your Own Deep Learning API
4549

app/main_test.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,20 @@
77

88
client = TestClient(app)
99

10+
1011
class ClassifierAPITest(unittest.TestCase):
1112

1213
TEST_COLOR_IMG_URL = "https://storage.googleapis.com/download.tensorflow.org/example_images/592px-Red_sunflower.jpg"
1314

1415
def test_make_prediction_normal(self):
15-
'''Client submits a RGB image and gets a valid response.'''
16+
"""Client submits a RGB image and gets a valid response."""
1617
# A: get image
1718
image_path = tf.keras.utils.get_file(
18-
origin=self.TEST_COLOR_IMG_URL,
19-
cache_dir=".", cache_subdir="./test-assets"
19+
origin=self.TEST_COLOR_IMG_URL, cache_dir=".", cache_subdir="./test-assets"
2020
)
21-
with open(image_path, 'rb') as f:
21+
with open(image_path, "rb") as f:
2222
# B: format a mock request
2323
files = {"file": (f.name, f, "multipart/form-data")}
2424
# C: make a request, and verify a valid prediction is returned
25-
response = client.post(
26-
'/detect-fire', files=files
27-
)
25+
response = client.post("/detect-fire", files=files)
2826
assert response.status_code == 307

classifier/util/__init__.py

Whitespace-only changes.

classifier/util/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ def __init__(self, config: Dict[str, str]):
2626

2727
@classmethod
2828
def reconstruct_model(cls, config):
29-
'''Make a new instance, and load in the model straightaway.'''
29+
"""Make a new instance, and load in the model straightaway."""
3030
model_utility = cls(config)
3131
# detect save format
32-
save_format = 'composite'
32+
save_format = "composite"
3333
if config["model_file_paths"] and len(config["model_file_paths"]) == 1:
34-
save_format = 'h5'
34+
save_format = "h5"
3535
# load the model
3636
return model_utility.load_model(save_format)
3737

0 commit comments

Comments
 (0)