Update visualizer_app.py
Browse files- visualizer_app.py +23 -10
visualizer_app.py
CHANGED
@@ -140,10 +140,16 @@ def client_instantiation(
|
|
140 |
else:
|
141 |
deployment_client = None
|
142 |
|
|
|
143 |
if project_client is not None:
|
144 |
task_credentials_details = setup_task_credentials(project_client)
|
145 |
-
|
146 |
task_credentials_details = setup_task_credentials(deployment_client)
|
|
|
|
|
|
|
|
|
|
|
147 |
else:
|
148 |
wx_credentials = None
|
149 |
project_client = None
|
@@ -433,7 +439,7 @@ def active_client(client_selector):
|
|
433 |
|
434 |
@app.cell
|
435 |
def emb_model_selection(client, set_embedding_model_list):
|
436 |
-
if client is not None:
|
437 |
model_specs = client.foundation_models.get_embeddings_model_specs()
|
438 |
# model_specs = client.foundation_models.get_model_specs()
|
439 |
resources = model_specs["resources"]
|
@@ -509,16 +515,22 @@ def embedding_model():
|
|
509 |
|
510 |
@app.cell
|
511 |
def emb_model_parameters(emb_model_max_tk):
|
512 |
-
from ibm_watsonx_ai.foundation_models import Embeddings
|
513 |
from ibm_watsonx_ai.metanames import EmbedTextParamsMetaNames as EmbedParams
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
|
|
519 |
}
|
520 |
-
|
521 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
|
523 |
|
524 |
@app.cell
|
@@ -542,6 +554,7 @@ def emb_model_setup(embedding_model):
|
|
542 |
|
543 |
@app.cell
|
544 |
def emb_model_instantiation(Embeddings, client, emb_model, embed_params):
|
|
|
545 |
if client is not None:
|
546 |
embedding = Embeddings(
|
547 |
model_id=emb_model,
|
|
|
140 |
else:
|
141 |
deployment_client = None
|
142 |
|
143 |
+
|
144 |
if project_client is not None:
|
145 |
task_credentials_details = setup_task_credentials(project_client)
|
146 |
+
elif deployment_client is not None:
|
147 |
task_credentials_details = setup_task_credentials(deployment_client)
|
148 |
+
elif project_client is not None and deployment_client is not None:
|
149 |
+
task_credentials_details = setup_task_credentials(project_client)
|
150 |
+
else:
|
151 |
+
task_credentials_details = None
|
152 |
+
|
153 |
else:
|
154 |
wx_credentials = None
|
155 |
project_client = None
|
|
|
439 |
|
440 |
@app.cell
|
441 |
def emb_model_selection(client, set_embedding_model_list):
|
442 |
+
if client_instantiation_form.value and client is not None:
|
443 |
model_specs = client.foundation_models.get_embeddings_model_specs()
|
444 |
# model_specs = client.foundation_models.get_model_specs()
|
445 |
resources = model_specs["resources"]
|
|
|
515 |
|
516 |
@app.cell
|
517 |
def emb_model_parameters(emb_model_max_tk):
|
|
|
518 |
from ibm_watsonx_ai.metanames import EmbedTextParamsMetaNames as EmbedParams
|
519 |
+
if client is not None:
|
520 |
+
embed_params = {
|
521 |
+
EmbedParams.TRUNCATE_INPUT_TOKENS: emb_model_max_tk,
|
522 |
+
EmbedParams.RETURN_OPTIONS: {
|
523 |
+
'input_text': True
|
524 |
+
}
|
525 |
}
|
526 |
+
else:
|
527 |
+
embed_params = {
|
528 |
+
EmbedParams.TRUNCATE_INPUT_TOKENS: 128,
|
529 |
+
EmbedParams.RETURN_OPTIONS: {
|
530 |
+
'input_text': True
|
531 |
+
}
|
532 |
+
}
|
533 |
+
return embed_params
|
534 |
|
535 |
|
536 |
@app.cell
|
|
|
554 |
|
555 |
@app.cell
|
556 |
def emb_model_instantiation(Embeddings, client, emb_model, embed_params):
|
557 |
+
from ibm_watsonx_ai.foundation_models import Embeddings
|
558 |
if client is not None:
|
559 |
embedding = Embeddings(
|
560 |
model_id=emb_model,
|