Spaces:
Runtime error
Runtime error
matthewfarant
commited on
Commit
•
c31d0b7
1
Parent(s):
bd1a00f
Update app.py
Browse files
app.py
CHANGED
@@ -49,7 +49,7 @@ def prepare_catalog():
|
|
49 |
def decision(user_input, type, catalog, product_name_catalog):
|
50 |
# Initialize the model
|
51 |
pipe_detect = pipeline("text-classification", model="matthewfarant/indobert-fertilizer-classifier", token = os.getenv('HF_MY_TOKEN'))
|
52 |
-
pipe_match = pipeline("text-classification", model="matthewfarant/
|
53 |
|
54 |
# Extract formula
|
55 |
user_input_formula = re.findall(r'\d{1,2}\s*[- ]\s*\d{1,2}\s*[- ]\s*\d{1,2}', user_input)
|
@@ -92,7 +92,7 @@ def decision(user_input, type, catalog, product_name_catalog):
|
|
92 |
|
93 |
# Based on probability
|
94 |
|
95 |
-
catalog['Concat Input'] = user_input + '
|
96 |
|
97 |
catalog['Similarity Score'] = catalog['Concat Input'].apply(lambda x: pipe_match(x)[0]['score'])
|
98 |
|
|
|
49 |
def decision(user_input, type, catalog, product_name_catalog):
|
50 |
# Initialize the model
|
51 |
pipe_detect = pipeline("text-classification", model="matthewfarant/indobert-fertilizer-classifier", token = os.getenv('HF_MY_TOKEN'))
|
52 |
+
pipe_match = pipeline("text-classification", model="matthewfarant/autotrain-fertilizer-pair-classify", token = os.getenv('HF_MY_TOKEN'))
|
53 |
|
54 |
# Extract formula
|
55 |
user_input_formula = re.findall(r'\d{1,2}\s*[- ]\s*\d{1,2}\s*[- ]\s*\d{1,2}', user_input)
|
|
|
92 |
|
93 |
# Based on probability
|
94 |
|
95 |
+
catalog['Concat Input'] = user_input + '[SEP]' + catalog['Registered Product'].astype(str)
|
96 |
|
97 |
catalog['Similarity Score'] = catalog['Concat Input'].apply(lambda x: pipe_match(x)[0]['score'])
|
98 |
|