Spaces:
Runtime error
Runtime error
some db updates
Browse files
app.py
CHANGED
|
@@ -44,9 +44,6 @@ potential_labels = get_potential_labels()
|
|
| 44 |
|
| 45 |
# Function to handle the classification
|
| 46 |
def classify_email(constituent_email):
|
| 47 |
-
global potential_labels
|
| 48 |
-
potential_labels = get_potential_labels()
|
| 49 |
-
|
| 50 |
print("classifying email")
|
| 51 |
model_out = classifier_model(constituent_email, potential_labels, multi_label=True)
|
| 52 |
print("classification complete")
|
|
@@ -100,8 +97,8 @@ def save_data(orig_user_email, constituent_email, labels, user_response):
|
|
| 100 |
label_exists = db_cursor.fetchall()
|
| 101 |
if label_exists:
|
| 102 |
db_cursor.execute(
|
| 103 |
-
"INSERT INTO message_category_associations (message_id, message_category_id) VALUES ((SELECT id FROM messages WHERE body = %s),
|
| 104 |
-
(constituent_email,
|
| 105 |
)
|
| 106 |
|
| 107 |
db_connection.commit()
|
|
|
|
| 44 |
|
| 45 |
# Function to handle the classification
|
| 46 |
def classify_email(constituent_email):
|
|
|
|
|
|
|
|
|
|
| 47 |
print("classifying email")
|
| 48 |
model_out = classifier_model(constituent_email, potential_labels, multi_label=True)
|
| 49 |
print("classification complete")
|
|
|
|
| 97 |
label_exists = db_cursor.fetchall()
|
| 98 |
if label_exists:
|
| 99 |
db_cursor.execute(
|
| 100 |
+
"INSERT INTO message_category_associations (message_id, message_category_id) VALUES ((SELECT id FROM messages WHERE body = %s), %i)",
|
| 101 |
+
(constituent_email, label_exists[0][0]),
|
| 102 |
)
|
| 103 |
|
| 104 |
db_connection.commit()
|