MilanM commited on
Commit
ebac633
·
verified ·
1 Parent(s): e024a18

Update visualizer_app.py

Browse files
Files changed (1) hide show
  1. visualizer_app.py +14 -15
visualizer_app.py CHANGED
@@ -109,9 +109,8 @@ def _(client_setup, wx_api_key):
109
  @app.cell
110
  def _():
111
  baked_in_creds = {
112
- "purpose": "",
113
- "api_key": "",
114
- "project_id": "",
115
  "space_id": "",
116
  }
117
  return baked_in_creds
@@ -143,16 +142,16 @@ def client_instantiation(
143
  deployment_client = None
144
 
145
 
146
- if project_client is not None:
147
- task_credentials_details = setup_task_credentials(project_client)
148
- else:
149
- task_credentials_details = setup_task_credentials(deployment_client)
150
 
151
  else:
152
  wx_credentials = None
153
  project_client = None
154
  deployment_client = None
155
- task_credentials_details = None
156
 
157
  client_status = mo.md("### Client Instantiation Status will turn Green When Ready")
158
 
@@ -350,7 +349,7 @@ def file_and_model_select(
350
  get_embedding_model_list,
351
  run_upload_button,
352
  ):
353
- select_stack = mo.hstack([get_embedding_model_list(), mo.vstack([file_loader, run_upload_button], align="center")], justify="space-around", align="center", widths=[0.3,0.3])
354
  return (select_stack,)
355
 
356
 
@@ -384,13 +383,13 @@ def client_instantiation_form():
384
  > If you provide both you can switch the active one in the dropdown.
385
  ''')
386
  .batch(
387
- wx_region = mo.ui.dropdown(regions, label="Select your watsonx.ai region:", value="US", searchable=True),
388
  wx_api_key = mo.ui.text(placeholder="Add your IBM Cloud api-key...", label="IBM Cloud Api-key:",
389
  kind="password", value=get_cred_value('api_key', creds_var_name='baked_in_creds')),
390
  project_id = mo.ui.text(placeholder="Add your watsonx.ai project_id...", label="Project_ID:",
391
- kind="text", value=get_cred_value('project_id', creds_var_name='baked_in_creds')),
392
  space_id = mo.ui.text(placeholder="Add your watsonx.ai space_id...", label="Space_ID:",
393
- kind="text", value=get_cred_value('space_id', creds_var_name='baked_in_creds'))
394
  ,)
395
  .form(show_clear_button=True, bordered=False)
396
  )
@@ -731,7 +730,7 @@ def sentence_splitter_setup():
731
  value="[^,.;?!]+[,.;?!]?"),
732
  include_metadata= mo.ui.checkbox(value=True, label="**Include Metadata**")
733
  )
734
- .form(show_clear_button=True, bordered=False)
735
  )
736
  return (sentence_splitter_config,)
737
 
@@ -1651,7 +1650,7 @@ def prepare_doc_select(sentence_splitter_config):
1651
  full_width=True,
1652
  show_value=True,
1653
  label="**Select a Range of Chunks to Visualize:**"
1654
- ).form(submit_button_disabled=check_state(sentence_splitter_config.value))
1655
 
1656
  return llama_docs
1657
  return (prepare_document_selection,)
@@ -1839,7 +1838,7 @@ def create_baseline_chart(
1839
  def test_query(get_chunk_state):
1840
  placeholder = """How can i use watsonx.data to perform vector search?"""
1841
 
1842
- query = mo.ui.text_area(label="**Write text to check:**", full_width=True, rows=8, value=placeholder).form(show_clear_button=True, submit_button_disabled=check_state(get_chunk_state()))
1843
  return (query,)
1844
 
1845
 
 
109
  @app.cell
110
  def _():
111
  baked_in_creds = {
112
+ "api_key": os.environ.get("WX_APIKEY"),
113
+ "project_id": os.environ.get("WX_PROJECT_ID"),
 
114
  "space_id": "",
115
  }
116
  return baked_in_creds
 
142
  deployment_client = None
143
 
144
 
145
+ # if project_client is not None:
146
+ # task_credentials_details = setup_task_credentials(project_client)
147
+ # else:
148
+ # task_credentials_details = setup_task_credentials(deployment_client)
149
 
150
  else:
151
  wx_credentials = None
152
  project_client = None
153
  deployment_client = None
154
+ # task_credentials_details = None
155
 
156
  client_status = mo.md("### Client Instantiation Status will turn Green When Ready")
157
 
 
349
  get_embedding_model_list,
350
  run_upload_button,
351
  ):
352
+ select_stack = mo.hstack([get_embedding_model_list(), mo.vstack([mo.md("Drag & Drop or Double Click to select PDFs, then press **Load Files**"),file_loader, run_upload_button], align="center")], justify="space-around", align="center", widths=[0.3,0.3])
353
  return (select_stack,)
354
 
355
 
 
383
  > If you provide both you can switch the active one in the dropdown.
384
  ''')
385
  .batch(
386
+ wx_region = mo.ui.dropdown(regions, label="Select your watsonx.ai region:", value="EU", searchable=True),
387
  wx_api_key = mo.ui.text(placeholder="Add your IBM Cloud api-key...", label="IBM Cloud Api-key:",
388
  kind="password", value=get_cred_value('api_key', creds_var_name='baked_in_creds')),
389
  project_id = mo.ui.text(placeholder="Add your watsonx.ai project_id...", label="Project_ID:",
390
+ kind="password", value=get_cred_value('project_id', creds_var_name='baked_in_creds')),
391
  space_id = mo.ui.text(placeholder="Add your watsonx.ai space_id...", label="Space_ID:",
392
+ kind="password", value=get_cred_value('space_id', creds_var_name='baked_in_creds'))
393
  ,)
394
  .form(show_clear_button=True, bordered=False)
395
  )
 
730
  value="[^,.;?!]+[,.;?!]?"),
731
  include_metadata= mo.ui.checkbox(value=True, label="**Include Metadata**")
732
  )
733
+ .form(show_clear_button=True, bordered=False, submit_button_label="Chunk Documents")
734
  )
735
  return (sentence_splitter_config,)
736
 
 
1650
  full_width=True,
1651
  show_value=True,
1652
  label="**Select a Range of Chunks to Visualize:**"
1653
+ ).form(submit_button_disabled=check_state(sentence_splitter_config.value), submit_button_label="Change Document View Range"))
1654
 
1655
  return llama_docs
1656
  return (prepare_document_selection,)
 
1838
  def test_query(get_chunk_state):
1839
  placeholder = """How can i use watsonx.data to perform vector search?"""
1840
 
1841
+ query = mo.ui.text_area(label="**Write text to check:**", full_width=True, rows=8, value=placeholder).form(show_clear_button=True, submit_button_disabled=check_state(get_chunk_state()), submit_button_label="Query and View Visualization"))
1842
  return (query,)
1843
 
1844