Commit
·
947bf26
1
Parent(s):
1be780a
updating typos
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ classifier = pipeline("zero-shot-classification",
|
|
12 |
def zero_shot(doc, candidates):
|
13 |
given_labels = candidates.split(",")
|
14 |
given_labels = list(map(str.strip, given_labels))
|
15 |
-
dictionary = classifier(doc, given_labels)
|
16 |
labels = dictionary['labels']
|
17 |
scores = dictionary['scores']
|
18 |
return dict(zip(labels, scores))
|
@@ -38,17 +38,17 @@ output = gr.Label(label="Output")
|
|
38 |
|
39 |
#example object
|
40 |
transactions_and_tags = [
|
41 |
-
["MPS/TRUFFLES /202303261700/034587/Bangalore", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
42 |
-
["MPS/TACO BELL /202304012247/108300/BANGALORE", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
43 |
-
["POS XXXXXXXXXXXX0001 APOLLO PHARMACY", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
44 |
-
["BIL/ONL/000471093694/1MG Techno/X7ZRUSVLURFQZO", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
45 |
-
["POS XXXXXXXXXXXX1111 DECATHLON SPORTS", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
46 |
-
["POS XXXXXXXXXXXX1111 IKEA INDIA PVT L", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
47 |
-
["POS XXXXXXXXXXXX1111 WWW AMAZON IN", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
48 |
-
["ME DC SI XXXXXXXXXXXX1111 SPOTIFY SI", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
49 |
-
["POS/NETFLIX/1140920002/100623/17:25", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
50 |
-
["POS XXXXXXXXXXXX1110 MAKEMYTRIP INDIA", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"],
|
51 |
-
["BIL/ONL/000691178015/IRCTC Serv/XZZBX91LTCY1AZ", "Medical,Food,Shopping,Subscription,Travel, Miscellaneous"]
|
52 |
]
|
53 |
|
54 |
#create interface
|
|
|
12 |
def zero_shot(doc, candidates):
|
13 |
given_labels = candidates.split(",")
|
14 |
given_labels = list(map(str.strip, given_labels))
|
15 |
+
dictionary = classifier(preprocess(doc), given_labels)
|
16 |
labels = dictionary['labels']
|
17 |
scores = dictionary['scores']
|
18 |
return dict(zip(labels, scores))
|
|
|
38 |
|
39 |
#example object
|
40 |
transactions_and_tags = [
|
41 |
+
["MPS/TRUFFLES /202303261700/034587/Bangalore", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
42 |
+
["MPS/TACO BELL /202304012247/108300/BANGALORE", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
43 |
+
["POS XXXXXXXXXXXX0001 APOLLO PHARMACY", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
44 |
+
["BIL/ONL/000471093694/1MG Techno/X7ZRUSVLURFQZO", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
45 |
+
["POS XXXXXXXXXXXX1111 DECATHLON SPORTS", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
46 |
+
["POS XXXXXXXXXXXX1111 IKEA INDIA PVT L", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
47 |
+
["POS XXXXXXXXXXXX1111 WWW AMAZON IN", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
48 |
+
["ME DC SI XXXXXXXXXXXX1111 SPOTIFY SI", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
49 |
+
["POS/NETFLIX/1140920002/100623/17:25", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
50 |
+
["POS XXXXXXXXXXXX1110 MAKEMYTRIP INDIA", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
51 |
+
["BIL/ONL/000691178015/IRCTC Serv/XZZBX91LTCY1AZ", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"]
|
52 |
]
|
53 |
|
54 |
#create interface
|