Spaces:
Runtime error
Runtime error
"newcp"
Browse files- app.py +2 -1
- cache/intent/intent2idx.json +148 -148
- cache/intent/vocab.pkl +2 -2
app.py
CHANGED
@@ -7,6 +7,7 @@ import pickle
|
|
7 |
from pathlib import Path
|
8 |
from utils import Vocab
|
9 |
from model import SeqClassifier
|
|
|
10 |
|
11 |
# Set model parameters
|
12 |
max_len = 128
|
@@ -57,7 +58,7 @@ best_model.eval()
|
|
57 |
|
58 |
# Processing function to convert text to embedding indices
|
59 |
def collate_fn(texts: str) -> torch.tensor:
|
60 |
-
texts =
|
61 |
encoded_texts = vocab.encode_batch([[text for text in texts]], to_len=max_len)[0]
|
62 |
encoded_text = torch.tensor(encoded_texts)
|
63 |
return encoded_text
|
|
|
7 |
from pathlib import Path
|
8 |
from utils import Vocab
|
9 |
from model import SeqClassifier
|
10 |
+
import re
|
11 |
|
12 |
# Set model parameters
|
13 |
max_len = 128
|
|
|
58 |
|
59 |
# Processing function to convert text to embedding indices
|
60 |
def collate_fn(texts: str) -> torch.tensor:
|
61 |
+
texts = re.findall(r"\w+|[^\w\s]", texts)
|
62 |
encoded_texts = vocab.encode_batch([[text for text in texts]], to_len=max_len)[0]
|
63 |
encoded_text = torch.tensor(encoded_texts)
|
64 |
return encoded_text
|
cache/intent/intent2idx.json
CHANGED
@@ -1,152 +1,152 @@
|
|
1 |
{
|
2 |
-
"
|
3 |
-
"
|
4 |
-
"
|
5 |
-
"
|
6 |
-
"
|
7 |
-
"
|
8 |
-
"
|
9 |
-
"
|
10 |
-
"
|
11 |
-
"
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"
|
16 |
-
"
|
17 |
-
"
|
18 |
-
"
|
19 |
-
"
|
20 |
-
"
|
21 |
-
"
|
22 |
-
"
|
23 |
-
"
|
24 |
-
"
|
25 |
-
"
|
26 |
-
"
|
27 |
-
"
|
28 |
-
"
|
29 |
-
"
|
30 |
-
"
|
31 |
-
"
|
32 |
-
"
|
33 |
-
"
|
34 |
-
"
|
35 |
-
"
|
36 |
-
"
|
37 |
-
"
|
38 |
-
"
|
39 |
-
"
|
40 |
-
"
|
41 |
-
"
|
42 |
-
"
|
43 |
-
"
|
44 |
-
"
|
45 |
-
"
|
46 |
-
"
|
47 |
-
"
|
48 |
-
"
|
49 |
-
"
|
50 |
-
"
|
51 |
-
"
|
52 |
-
"
|
53 |
-
"
|
54 |
-
"
|
55 |
-
"
|
56 |
-
"
|
57 |
-
"
|
58 |
-
"
|
59 |
-
"
|
60 |
-
"
|
61 |
-
"
|
62 |
-
"
|
63 |
-
"
|
64 |
-
"
|
65 |
-
"
|
66 |
-
"
|
67 |
-
"
|
68 |
-
"
|
69 |
-
"
|
70 |
-
"
|
71 |
-
"
|
72 |
-
"
|
73 |
-
"
|
74 |
-
"
|
75 |
-
"
|
76 |
-
"
|
77 |
-
"
|
78 |
-
"
|
79 |
-
"
|
80 |
-
"
|
81 |
-
"
|
82 |
-
"
|
83 |
-
"
|
84 |
-
"
|
85 |
-
"
|
86 |
-
"
|
87 |
-
"
|
88 |
-
"
|
89 |
-
"
|
90 |
-
"
|
91 |
"card_declined": 89,
|
92 |
-
"
|
93 |
-
"
|
94 |
-
"
|
95 |
-
"
|
96 |
-
"
|
97 |
-
"
|
98 |
-
"
|
99 |
-
"
|
100 |
-
"
|
101 |
-
"
|
102 |
-
"
|
103 |
-
"
|
104 |
-
"
|
105 |
-
"
|
106 |
-
"
|
107 |
-
"
|
108 |
-
"
|
109 |
-
"
|
110 |
-
"
|
111 |
-
"
|
112 |
-
"
|
113 |
-
"
|
114 |
-
"
|
115 |
-
"
|
116 |
-
"
|
117 |
-
"
|
118 |
-
"
|
119 |
-
"
|
120 |
-
"
|
121 |
-
"
|
122 |
-
"
|
123 |
-
"
|
124 |
-
"
|
125 |
"calories": 123,
|
126 |
-
"
|
127 |
-
"
|
128 |
-
"
|
129 |
-
"
|
130 |
-
"
|
131 |
-
"
|
132 |
-
"
|
133 |
-
"
|
134 |
-
"
|
135 |
-
"
|
136 |
-
"
|
137 |
-
"
|
138 |
-
"
|
139 |
-
"
|
140 |
-
"
|
141 |
-
"
|
142 |
-
"
|
143 |
-
"
|
144 |
-
"
|
145 |
-
"
|
146 |
-
"
|
147 |
-
"
|
148 |
-
"
|
149 |
-
"
|
150 |
-
"
|
151 |
-
"
|
152 |
}
|
|
|
1 |
{
|
2 |
+
"do_you_have_pets": 0,
|
3 |
+
"confirm_reservation": 1,
|
4 |
+
"new_card": 2,
|
5 |
+
"lost_luggage": 3,
|
6 |
+
"bill_due": 4,
|
7 |
+
"calendar": 5,
|
8 |
+
"text": 6,
|
9 |
+
"date": 7,
|
10 |
+
"insurance_change": 8,
|
11 |
+
"user_name": 9,
|
12 |
+
"min_payment": 10,
|
13 |
+
"reminder_update": 11,
|
14 |
+
"pto_request": 12,
|
15 |
+
"cancel": 13,
|
16 |
+
"change_speed": 14,
|
17 |
+
"change_accent": 15,
|
18 |
+
"cancel_reservation": 16,
|
19 |
+
"gas_type": 17,
|
20 |
+
"goodbye": 18,
|
21 |
+
"accept_reservations": 19,
|
22 |
+
"uber": 20,
|
23 |
+
"apr": 21,
|
24 |
+
"repeat": 22,
|
25 |
+
"directions": 23,
|
26 |
+
"tell_joke": 24,
|
27 |
+
"car_rental": 25,
|
28 |
+
"make_call": 26,
|
29 |
+
"taxes": 27,
|
30 |
+
"gas": 28,
|
31 |
+
"carry_on": 29,
|
32 |
+
"improve_credit_score": 30,
|
33 |
+
"what_song": 31,
|
34 |
+
"pto_used": 32,
|
35 |
+
"rewards_balance": 33,
|
36 |
+
"roll_dice": 34,
|
37 |
+
"weather": 35,
|
38 |
+
"flight_status": 36,
|
39 |
+
"spelling": 37,
|
40 |
+
"calculator": 38,
|
41 |
+
"rollover_401k": 39,
|
42 |
+
"what_can_i_ask_you": 40,
|
43 |
+
"report_fraud": 41,
|
44 |
+
"update_playlist": 42,
|
45 |
+
"travel_suggestion": 43,
|
46 |
+
"tire_change": 44,
|
47 |
+
"international_fees": 45,
|
48 |
+
"transactions": 46,
|
49 |
+
"change_ai_name": 47,
|
50 |
+
"order_status": 48,
|
51 |
+
"restaurant_reservation": 49,
|
52 |
+
"what_is_your_name": 50,
|
53 |
+
"measurement_conversion": 51,
|
54 |
+
"fun_fact": 52,
|
55 |
+
"tire_pressure": 53,
|
56 |
+
"todo_list_update": 54,
|
57 |
+
"order": 55,
|
58 |
+
"report_lost_card": 56,
|
59 |
+
"time": 57,
|
60 |
+
"travel_alert": 58,
|
61 |
+
"pay_bill": 59,
|
62 |
+
"todo_list": 60,
|
63 |
+
"pin_change": 61,
|
64 |
+
"thank_you": 62,
|
65 |
+
"change_language": 63,
|
66 |
+
"who_made_you": 64,
|
67 |
+
"shopping_list": 65,
|
68 |
+
"ingredients_list": 66,
|
69 |
+
"international_visa": 67,
|
70 |
+
"interest_rate": 68,
|
71 |
+
"book_hotel": 69,
|
72 |
+
"nutrition_info": 70,
|
73 |
+
"schedule_meeting": 71,
|
74 |
+
"are_you_a_bot": 72,
|
75 |
+
"payday": 73,
|
76 |
+
"insurance": 74,
|
77 |
+
"application_status": 75,
|
78 |
+
"restaurant_reviews": 76,
|
79 |
+
"what_are_your_hobbies": 77,
|
80 |
+
"whisper_mode": 78,
|
81 |
+
"w2": 79,
|
82 |
+
"pto_balance": 80,
|
83 |
+
"maybe": 81,
|
84 |
+
"exchange_rate": 82,
|
85 |
+
"account_blocked": 83,
|
86 |
+
"sync_device": 84,
|
87 |
+
"where_are_you_from": 85,
|
88 |
+
"income": 86,
|
89 |
+
"plug_type": 87,
|
90 |
+
"current_location": 88,
|
91 |
"card_declined": 89,
|
92 |
+
"no": 90,
|
93 |
+
"reminder": 91,
|
94 |
+
"freeze_account": 92,
|
95 |
+
"timezone": 93,
|
96 |
+
"jump_start": 94,
|
97 |
+
"book_flight": 95,
|
98 |
+
"meaning_of_life": 96,
|
99 |
+
"play_music": 97,
|
100 |
+
"spending_history": 98,
|
101 |
+
"routing": 99,
|
102 |
+
"yes": 100,
|
103 |
+
"change_volume": 101,
|
104 |
+
"timer": 102,
|
105 |
+
"next_song": 103,
|
106 |
+
"expiration_date": 104,
|
107 |
+
"bill_balance": 105,
|
108 |
+
"restaurant_suggestion": 106,
|
109 |
+
"mpg": 107,
|
110 |
+
"greeting": 108,
|
111 |
+
"vaccines": 109,
|
112 |
+
"credit_limit": 110,
|
113 |
+
"find_phone": 111,
|
114 |
+
"shopping_list_update": 112,
|
115 |
+
"change_user_name": 113,
|
116 |
+
"credit_limit_change": 114,
|
117 |
+
"share_location": 115,
|
118 |
+
"distance": 116,
|
119 |
+
"how_old_are_you": 117,
|
120 |
+
"reset_settings": 118,
|
121 |
+
"direct_deposit": 119,
|
122 |
+
"transfer": 120,
|
123 |
+
"travel_notification": 121,
|
124 |
+
"redeem_rewards": 122,
|
125 |
"calories": 123,
|
126 |
+
"recipe": 124,
|
127 |
+
"who_do_you_work_for": 125,
|
128 |
+
"pto_request_status": 126,
|
129 |
+
"last_maintenance": 127,
|
130 |
+
"translate": 128,
|
131 |
+
"alarm": 129,
|
132 |
+
"damaged_card": 130,
|
133 |
+
"meal_suggestion": 131,
|
134 |
+
"order_checks": 132,
|
135 |
+
"definition": 133,
|
136 |
+
"meeting_schedule": 134,
|
137 |
+
"balance": 135,
|
138 |
+
"how_busy": 136,
|
139 |
+
"schedule_maintenance": 137,
|
140 |
+
"credit_score": 138,
|
141 |
+
"oil_change_how": 139,
|
142 |
+
"replacement_card_duration": 140,
|
143 |
+
"flip_coin": 141,
|
144 |
+
"food_last": 142,
|
145 |
+
"oil_change_when": 143,
|
146 |
+
"ingredient_substitution": 144,
|
147 |
+
"calendar_update": 145,
|
148 |
+
"cook_time": 146,
|
149 |
+
"next_holiday": 147,
|
150 |
+
"traffic": 148,
|
151 |
+
"smart_home": 149
|
152 |
}
|
cache/intent/vocab.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c98fcf18cd7d789236b4f28803c90bb00f8ecd3a0b13eb647bdb14a6d173fdb3
|
3 |
+
size 68005
|