Feliks Zaslavskiy commited on
Commit
ea4c492
1 Parent(s): 59dea20

UI updates. fix column name

Browse files
Files changed (2) hide show
  1. Addr-Test.xlsx +0 -0
  2. app.py +14 -6
Addr-Test.xlsx CHANGED
Binary files a/Addr-Test.xlsx and b/Addr-Test.xlsx differ
 
app.py CHANGED
@@ -13,10 +13,10 @@ model = AlbertModel.from_pretrained('albert-' + model_size + '-v2')
13
  def get_embedding(input_text):
14
  encoded_input = tokenizer(input_text, return_tensors='pt')
15
  input_ids = encoded_input.input_ids
16
- input_num_tokens = input_ids.shape[1]
17
 
18
- print( "Number of input tokens: " + str(input_num_tokens))
19
- print("Length of input: " + str(len(input_text)))
20
 
21
  list_of_tokens = tokenizer.convert_ids_to_tokens(input_ids.view(-1).tolist())
22
 
@@ -29,6 +29,7 @@ def get_embedding(input_text):
29
  #sentence_embedding = output.last_hidden_state[0][0]
30
  return sentence_embedding.tolist()
31
 
 
32
  st.title('Upload the Address Dataset')
33
 
34
  st.markdown('Upload an Excel file to view the data in a table.')
@@ -36,6 +37,7 @@ st.markdown('Upload an Excel file to view the data in a table.')
36
  uploaded_file = st.file_uploader('Choose a file', type='xlsx')
37
 
38
 
 
39
  if uploaded_file is not None:
40
  data_caqh = pd.read_excel(uploaded_file, sheet_name='CAQH', dtype=str)
41
  data_ndb = pd.read_excel(uploaded_file, sheet_name='NDB', dtype=str)
@@ -56,7 +58,7 @@ if uploaded_file is not None:
56
  + data_ndb['zip_pls_4_cd'].astype(str))
57
 
58
  data_ndb['full-addr'] = data_ndb['adr_ln_1_txt'].astype(str).str.strip() + ', ' \
59
- + data_ndb['city'].astype(str) + ', ' \
60
  + data_ndb['st_cd'].astype(str) + ', ' + data_ndb['zip_cd_zip_pls_4_cd']
61
 
62
  # App
@@ -79,8 +81,14 @@ if uploaded_file is not None:
79
  else:
80
  data_caqh.at[i, 'matched-addr'] = 'No Matches'
81
 
82
- st.dataframe(data_caqh)
83
- st.dataframe(data_ndb)
 
 
 
 
 
 
84
 
85
  # calculate the embedding of each item.
86
 
 
13
  def get_embedding(input_text):
14
  encoded_input = tokenizer(input_text, return_tensors='pt')
15
  input_ids = encoded_input.input_ids
16
+ #input_num_tokens = input_ids.shape[1]
17
 
18
+ #print( "Number of input tokens: " + str(input_num_tokens))
19
+ #print("Length of input: " + str(len(input_text)))
20
 
21
  list_of_tokens = tokenizer.convert_ids_to_tokens(input_ids.view(-1).tolist())
22
 
 
29
  #sentence_embedding = output.last_hidden_state[0][0]
30
  return sentence_embedding.tolist()
31
 
32
+ st. set_page_config(layout="wide")
33
  st.title('Upload the Address Dataset')
34
 
35
  st.markdown('Upload an Excel file to view the data in a table.')
 
37
  uploaded_file = st.file_uploader('Choose a file', type='xlsx')
38
 
39
 
40
+
41
  if uploaded_file is not None:
42
  data_caqh = pd.read_excel(uploaded_file, sheet_name='CAQH', dtype=str)
43
  data_ndb = pd.read_excel(uploaded_file, sheet_name='NDB', dtype=str)
 
58
  + data_ndb['zip_pls_4_cd'].astype(str))
59
 
60
  data_ndb['full-addr'] = data_ndb['adr_ln_1_txt'].astype(str).str.strip() + ', ' \
61
+ + data_ndb['cty_nm'].astype(str) + ', ' \
62
  + data_ndb['st_cd'].astype(str) + ', ' + data_ndb['zip_cd_zip_pls_4_cd']
63
 
64
  # App
 
81
  else:
82
  data_caqh.at[i, 'matched-addr'] = 'No Matches'
83
 
84
+ # Drop columns not needed for display
85
+ data_caqh.drop(columns=['embedding'], inplace=True)
86
+ data_ndb.drop(columns=['embedding'], inplace=True)
87
+
88
+ st.header('CAQH addresses and matches')
89
+ st.dataframe(data_caqh, use_container_width=True)
90
+ st.header('NDB data')
91
+ st.dataframe(data_ndb, use_container_width=True)
92
 
93
  # calculate the embedding of each item.
94