gastonamengual commited on
Commit
3309eaa
·
1 Parent(s): a33bc7c
Files changed (4) hide show
  1. .vscode/launch.json +20 -0
  2. .vscode/settings.json +8 -0
  3. app.py +4 -3
  4. tests/test_model.py +3 -9
.vscode/launch.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Python: Pytest",
9
+ "type": "python",
10
+ "request": "launch",
11
+ "module": "pytest",
12
+ "args": ["tests/test_api.py"],
13
+ "console": "integratedTerminal",
14
+ "justMyCode": false,
15
+ "env": {
16
+ "PYTHONASYNCIODEBUG": "1"
17
+ }
18
+ }
19
+ ]
20
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "[python]": {
3
+ "editor.defaultFormatter": "ms-python.black-formatter"
4
+ },
5
+ "python.formatting.provider": "none",
6
+ "python.testing.pytestEnabled": true,
7
+ "python.testing.unittestEnabled": false,
8
+ }
app.py CHANGED
@@ -1,10 +1,11 @@
1
  import gradio
2
  from model.model import Model
3
- from numpy.typing import ArrayLike
4
 
5
- def main(processed_image: ArrayLike):
 
6
  model = Model()
7
- model.detect_object(processed_image)
 
8
 
9
  gradio_interface = gradio.Interface(fn=main, inputs="text", outputs="text")
10
  gradio_interface.launch()
 
1
  import gradio
2
  from model.model import Model
 
3
 
4
+ def main(list_encoded_image: str):
5
+ np.array(json.loads(list_encoded_image))
6
  model = Model()
7
+ processed_image
8
+ # model.detect_object(processed_image)
9
 
10
  gradio_interface = gradio.Interface(fn=main, inputs="text", outputs="text")
11
  gradio_interface.launch()
tests/test_model.py CHANGED
@@ -4,7 +4,7 @@ import os
4
  import numpy as np
5
  import pytest
6
 
7
- from object_detection_model.model import Model, ModelConfig
8
 
9
 
10
  @pytest.fixture
@@ -17,13 +17,7 @@ def test_detect_objects(sample_img_url: str):
17
  with open(sample_img_url, "rb") as image_file:
18
  image_bytes = io.BytesIO(image_file.read()).read()
19
  processed_image = np.frombuffer(image_bytes, dtype=np.uint8)
20
-
21
- model = Model(
22
- ModelConfig(
23
- config_file_path="object_detection_model/model_files/ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt",
24
- frozen_model_path="object_detection_model/model_files/frozen_inference_graph.pb",
25
- labels_path="object_detection_model/model_files/coco.names",
26
- )
27
- )
28
  model.detect_object(data=processed_image)
29
  assert type(image_bytes) == bytes
 
4
  import numpy as np
5
  import pytest
6
 
7
+ from model.model import Model
8
 
9
 
10
  @pytest.fixture
 
17
  with open(sample_img_url, "rb") as image_file:
18
  image_bytes = io.BytesIO(image_file.read()).read()
19
  processed_image = np.frombuffer(image_bytes, dtype=np.uint8)
20
+
21
+ model = Model()
 
 
 
 
 
 
22
  model.detect_object(data=processed_image)
23
  assert type(image_bytes) == bytes