Spaces:
Sleeping
Sleeping
jonathanjordan21
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -53,7 +53,7 @@ def respond(
|
|
53 |
|
54 |
if history and history[-1][-1][21:24] == "033":
|
55 |
list_his = ""
|
56 |
-
for his in history[::-1]
|
57 |
if his[-1][21:24] != "033":
|
58 |
break
|
59 |
list_his = his[0] + "\n" + list_his
|
@@ -61,11 +61,12 @@ def respond(
|
|
61 |
message += "\n" + list_his
|
62 |
|
63 |
# pattern = r'\b([A-Z]{1,2})\s?(\d{4})\s?([A-Z]{3})\b'
|
64 |
-
pattern = r'\b([A-Z]{1,2})\s?(\d{4})\s?([A-Z]{1,3})\b'
|
|
|
65 |
|
66 |
matches = re.findall(pattern, message)
|
67 |
|
68 |
-
plate_numbers = ", ".join([" ".join(x) for i,x in enumerate(matches)])
|
69 |
|
70 |
text_emb = model.encode(message)
|
71 |
scores = cos_sim(codes_emb, text_emb)[:,0]
|
|
|
53 |
|
54 |
if history and history[-1][-1][21:24] == "033":
|
55 |
list_his = ""
|
56 |
+
for his in history[::-1]:
|
57 |
if his[-1][21:24] != "033":
|
58 |
break
|
59 |
list_his = his[0] + "\n" + list_his
|
|
|
61 |
message += "\n" + list_his
|
62 |
|
63 |
# pattern = r'\b([A-Z]{1,2})\s?(\d{4})\s?([A-Z]{3})\b'
|
64 |
+
# pattern = r'\b([A-Z]{1,2})\s?(\d{4})\s?([A-Z]{1,3})\b'
|
65 |
+
pattern = r'\b([A-Za-z]{1,2})\s?(\d{4})\s?([A-Za-z]{1,3})\b'
|
66 |
|
67 |
matches = re.findall(pattern, message)
|
68 |
|
69 |
+
plate_numbers = ", ".join([" ".join(x) for i,x in enumerate(matches)]).upper()
|
70 |
|
71 |
text_emb = model.encode(message)
|
72 |
scores = cos_sim(codes_emb, text_emb)[:,0]
|