AMead10 commited on
Commit
27eb4fe
·
1 Parent(s): 655b450

updated categroies on the fly

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -27,9 +27,12 @@ db_cursor = db_connection.cursor()
27
 
28
  ORG_ID = 731
29
 
 
 
30
 
31
  def get_potential_labels():
32
  # get potential labels from db
 
33
  potential_labels = db_cursor.execute(
34
  "SELECT message_category_name FROM radmap_frog12.message_categorys"
35
  )
@@ -46,6 +49,7 @@ potential_labels = get_potential_labels()
46
 
47
  # Function to handle the classification
48
  def classify_email(constituent_email):
 
49
  print("classifying email")
50
  model_out = classifier_model(constituent_email, potential_labels, multi_label=True)
51
  print("classification complete")
 
27
 
28
  ORG_ID = 731
29
 
30
+ potential_labels = []
31
+
32
 
33
  def get_potential_labels():
34
  # get potential labels from db
35
+ global potential_labels
36
  potential_labels = db_cursor.execute(
37
  "SELECT message_category_name FROM radmap_frog12.message_categorys"
38
  )
 
49
 
50
  # Function to handle the classification
51
  def classify_email(constituent_email):
52
+ potential_labels = get_potential_labels()
53
  print("classifying email")
54
  model_out = classifier_model(constituent_email, potential_labels, multi_label=True)
55
  print("classification complete")