Commit
·
ae9e0c1
1
Parent(s):
947bf26
updating preprocess function
Browse files
app.py
CHANGED
|
@@ -12,6 +12,8 @@ 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(preprocess(doc), given_labels)
|
| 16 |
labels = dictionary['labels']
|
| 17 |
scores = dictionary['scores']
|
|
@@ -38,9 +40,9 @@ output = gr.Label(label="Output")
|
|
| 38 |
|
| 39 |
#example object
|
| 40 |
transactions_and_tags = [
|
| 41 |
-
["MPS/TRUFFLES
|
| 42 |
-
["MPS/TACO BELL
|
| 43 |
-
["POS
|
| 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"],
|
|
|
|
| 12 |
def zero_shot(doc, candidates):
|
| 13 |
given_labels = candidates.split(",")
|
| 14 |
given_labels = list(map(str.strip, given_labels))
|
| 15 |
+
doc = preprocess(doc)
|
| 16 |
+
print(doc)
|
| 17 |
dictionary = classifier(preprocess(doc), given_labels)
|
| 18 |
labels = dictionary['labels']
|
| 19 |
scores = dictionary['scores']
|
|
|
|
| 40 |
|
| 41 |
#example object
|
| 42 |
transactions_and_tags = [
|
| 43 |
+
["MPS/TRUFFLES/202303261700/034587/Bangalore", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
| 44 |
+
["MPS/TACO BELL/202304012247/108300/BANGALORE", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
| 45 |
+
["POS XXXXXXXXXXXX0001APOLLO PHARMACY", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
| 46 |
["BIL/ONL/000471093694/1MG Techno/X7ZRUSVLURFQZO", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
| 47 |
["POS XXXXXXXXXXXX1111 DECATHLON SPORTS", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|
| 48 |
["POS XXXXXXXXXXXX1111 IKEA INDIA PVT L", "Medical, Food, Shopping, Subscription, Travel, Miscellaneous"],
|