Skip to content

Commit aa47128

Browse files
committed
Added answer generation blueprint
1 parent 60177ee commit aa47128

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ __pycache__/
88
# Test images
99
images/*
1010

11+
# External scripts
12+
external/

modules/answer_generator.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class AnswerGenerator:
2+
@staticmethod
3+
def predict(comprehension, question):
4+
"""
5+
predict answer for a question based on the given data
6+
:param comprehension: data to read for answering the question
7+
:param question: question based on the comprehension
8+
:return: answer for the question
9+
"""
10+
pass
11+
12+
ag = AnswerGenerator()
13+
print(ag.predict("There are two people.", "How many people are there?"))

modules/object_detection.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ class ObjectDetector:
1212

1313
@staticmethod
1414
def predict(frame):
15-
16-
cv_net = cv2.dnn.readNetFromTensorflow(PATH_TO_MODEL_WEIGHTS, PATH_TO_GRAPH)
17-
labels = coco_label_reader(PATH_TO_LABELS)
18-
1915
"""
2016
predict objects in the frame
2117
:param frame: input image as numpy array
2218
:return: objects and bounding boxes
2319
"""
20+
cv_net = cv2.dnn.readNetFromTensorflow(PATH_TO_MODEL_WEIGHTS, PATH_TO_GRAPH)
21+
labels = coco_label_reader(PATH_TO_LABELS)
22+
2423
rows, cols, _ = frame.shape
2524
blob = cv2.dnn.blobFromImage(frame, size=(rows, cols), swapRB=True, crop=False)
2625
cv_net.setInput(blob)

0 commit comments

Comments
 (0)