Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -45,22 +45,22 @@ def answer_question(img, prompt):
|
|
45 |
|
46 |
return buffer.strip()
|
47 |
|
48 |
-
def extract_floats(text):
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
|
57 |
|
58 |
-
def extract_bbox(text):
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
|
65 |
# def process_answer(img, answer):
|
66 |
# if extract_bbox(answer) is not None:
|
|
|
45 |
|
46 |
return buffer.strip()
|
47 |
|
48 |
+
# def extract_floats(text):
|
49 |
+
# # Regular expression to match an array of four floating point numbers
|
50 |
+
# pattern = r"\[\s*(-?\d+\.\d+)\s*,\s*(-?\d+\.\d+)\s*,\s*(-?\d+\.\d+)\s*,\s*(-?\d+\.\d+)\s*\]"
|
51 |
+
# match = re.search(pattern, text)
|
52 |
+
# if match:
|
53 |
+
# # Extract the numbers and convert them to floats
|
54 |
+
# return [float(num) for num in match.groups()]
|
55 |
+
# return None # Return None if no match is found
|
56 |
|
57 |
|
58 |
+
# def extract_bbox(text):
|
59 |
+
# bbox = None
|
60 |
+
# if extract_floats(text) is not None:
|
61 |
+
# x1, y1, x2, y2 = extract_floats(text)
|
62 |
+
# bbox = (x1, y1, x2, y2)
|
63 |
+
# return bbox
|
64 |
|
65 |
# def process_answer(img, answer):
|
66 |
# if extract_bbox(answer) is not None:
|