MilanM commited on
Commit
c58f6ed
·
verified ·
1 Parent(s): f11c96b

Update main_app.py

Browse files
Files changed (1) hide show
  1. main_app.py +54 -14
main_app.py CHANGED
@@ -502,6 +502,8 @@ def _(
502
 
503
  3. If it isn't, you can create a custom software spec that adds a package_extension add-on to it. Use the template selector to see some examples, but when you are ready add your packages in the code editor after the "pip:" section.
504
 
 
 
505
  {yaml_template}
506
 
507
  4. Give your package extension and software spec names and descriptions and submit.
@@ -637,25 +639,46 @@ def _(ast, template, function_editor, mo, os):
637
  mo.md(f"Syntax error in function code: {str(e)}")
638
  return (function_name,)
639
 
 
 
 
 
 
 
 
 
640
 
641
  @app.cell
642
  def _(template):
643
  dependencies = template["dependencies"]
644
  dependencies_string = ', '.join(dependencies)
645
- added_yaml_template = f"""dependencies:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
646
  - pip
647
  - pip:
648
  {'\n'.join(f' - {dep}' for dep in dependencies)}
649
  """
650
-
651
- yaml_templates = {
652
- "empty": """dependencies:
653
  - pip
654
  - pip:
655
  - <library_name>
656
  - ...
657
  """
658
- }
659
 
660
  dependency_pack_name = template["function_name"] + "_dependencies"
661
  # After the yaml_template definition, add:
@@ -811,11 +834,20 @@ def _(check_packages, mo, package_df):
811
  package_analysis_stack = mo.vstack([check_packages, package_df], justify="center")
812
  return (package_analysis_stack,)
813
 
 
 
 
 
 
 
 
 
 
814
 
815
  @app.cell
816
  def _(client):
817
- if client is not None:
818
- base_sw_spec_id = "45f12dfe-aa78-5b8d-9f38-0ee223c47309"
819
  base_software_spec = client.software_specifications.get_details(base_sw_spec_id)
820
  else:
821
  base_sw_spec_id = None
@@ -1145,7 +1177,7 @@ def _(client, mo, pd, specs_df):
1145
  (specs_df["STATE"] == "supported")
1146
  & (
1147
  specs_df["NAME"].isin(
1148
- ["runtime-24.1-py3.11", "runtime-24.1-py3.11-cuda"]
1149
  )
1150
  )
1151
  ]
@@ -1157,13 +1189,17 @@ def _(client, mo, pd, specs_df):
1157
 
1158
  # Create a mapping dictionary for framework names based on software specifications
1159
  framework_mapping = {
1160
- "tensorflow_rt24.1-py3.11": "TensorFlow",
1161
- "pytorch-onnx_rt24.1-py3.11": "PyTorch",
 
 
1162
  "onnxruntime_opset_19": "ONNX or ONNXRuntime",
1163
- "runtime-24.1-py3.11": "AI Services/Python Functions/Python Scripts",
1164
  "autoai-ts_rt24.1-py3.11": "AutoAI",
1165
  "autoai-kb_rt24.1-py3.11": "AutoAI",
1166
- "runtime-24.1-py3.11-cuda": "CUDA-enabled (GPU) Python Runtime",
 
 
 
1167
  "runtime-24.1-r4.3": "R Runtime 4.3",
1168
  "spark-mllib_3.4": "Apache Spark 3.4",
1169
  "autoai-rag_rt24.1-py3.11": "AutoAI RAG",
@@ -1171,15 +1207,19 @@ def _(client, mo, pd, specs_df):
1171
 
1172
  # Define the preferred order for items to appear at the top
1173
  preferred_order = [
 
 
 
1174
  "runtime-24.1-py3.11",
1175
  "runtime-24.1-py3.11-cuda",
 
1176
  "runtime-24.1-r4.3",
1177
- "ai-service-v5-software-specification",
1178
  "autoai-rag_rt24.1-py3.11",
1179
  "autoai-ts_rt24.1-py3.11",
1180
  "autoai-kb_rt24.1-py3.11",
1181
  "tensorflow_rt24.1-py3.11",
1182
  "pytorch-onnx_rt24.1-py3.11",
 
1183
  "onnxruntime_opset_19",
1184
  "spark-mllib_3.4",
1185
  ]
@@ -1214,7 +1254,7 @@ def _(client, mo, pd, specs_df):
1214
  selection_table = mo.ui.table(
1215
  supported_specs,
1216
  selection="single", # Only allow selecting one row
1217
- label="#### **Select a supported software_spec runtime for your function asset** (For Python Functions select - *'runtime-24.1-py3.11'* ):",
1218
  initial_selection=[
1219
  0
1220
  ], # Now selecting the first row, which should be runtime-24.1-py3.11
 
502
 
503
  3. If it isn't, you can create a custom software spec that adds a package_extension add-on to it. Use the template selector to see some examples, but when you are ready add your packages in the code editor after the "pip:" section.
504
 
505
+ {base_software_spec_id_selector}
506
+
507
  {yaml_template}
508
 
509
  4. Give your package extension and software spec names and descriptions and submit.
 
639
  mo.md(f"Syntax error in function code: {str(e)}")
640
  return (function_name,)
641
 
642
+ @app.cell
643
+ def _():
644
+ base_spec_ids = {
645
+ "runtime-25.1-py3.12": "f47ae1c3-198e-5718-b59d-2ea471561e9e",
646
+ "runtime-24.1-py3.11": "45f12dfe-aa78-5b8d-9f38-0ee223c47309",
647
+ }
648
+ base_spec_id_names = list(base_spec_ids.keys())
649
+ return base_spec_id_names, base_spec_ids
650
 
651
  @app.cell
652
  def _(template):
653
  dependencies = template["dependencies"]
654
  dependencies_string = ', '.join(dependencies)
655
+
656
+ if base_software_spec_id_selector.value == "runtime-25.1-py3.12":
657
+ # Format for Python 3.12 - simple list without pip:
658
+ added_yaml_template = f"""dependencies:
659
+ {'\n'.join(f' - {dep}' for dep in dependencies)}
660
+ """
661
+ yaml_templates = {
662
+ "empty": """dependencies:
663
+ - <library_name>
664
+ - ...
665
+ """
666
+ }
667
+ else:
668
+ # Format for Python 3.11 - with pip:
669
+ added_yaml_template = f"""dependencies:
670
  - pip
671
  - pip:
672
  {'\n'.join(f' - {dep}' for dep in dependencies)}
673
  """
674
+ yaml_templates = {
675
+ "empty": """dependencies:
 
676
  - pip
677
  - pip:
678
  - <library_name>
679
  - ...
680
  """
681
+ }
682
 
683
  dependency_pack_name = template["function_name"] + "_dependencies"
684
  # After the yaml_template definition, add:
 
834
  package_analysis_stack = mo.vstack([check_packages, package_df], justify="center")
835
  return (package_analysis_stack,)
836
 
837
+ @app.cell
838
+ def _(base_spec_id_names, mo):
839
+ base_software_spec_id_selector = mo.ui.dropdown(
840
+ options=base_spec_id_names,
841
+ label="**Select your Base Software Specification** *(defaults to Python 3.12)*:",
842
+ allow_select_none=False,
843
+ value=base_spec_id_names[0],
844
+ )
845
+ return (base_software_spec_id_selector,)
846
 
847
  @app.cell
848
  def _(client):
849
+ if client is not None and base_software_spec_id_selector.value:
850
+ base_sw_spec_id = base_spec_ids[base_software_spec_id_selector.value]
851
  base_software_spec = client.software_specifications.get_details(base_sw_spec_id)
852
  else:
853
  base_sw_spec_id = None
 
1177
  (specs_df["STATE"] == "supported")
1178
  & (
1179
  specs_df["NAME"].isin(
1180
+ ["runtime-25.1-py3.12","runtime-25.1-py3.12-cuda","runtime-24.1-py3.11", "runtime-24.1-py3.11-cuda"]
1181
  )
1182
  )
1183
  ]
 
1189
 
1190
  # Create a mapping dictionary for framework names based on software specifications
1191
  framework_mapping = {
1192
+ "tensorflow_rt24.1-py3.11": "TensorFlow 3.11",
1193
+ "tensorflow_rt25.1-py3.12": "TensorFlow 3.12",
1194
+ "pytorch-onnx_rt24.1-py3.11": "PyTorch 3.11",
1195
+ "pytorch-onnx_rt25.1-py3.12": "PyTorch 3.12",
1196
  "onnxruntime_opset_19": "ONNX or ONNXRuntime",
 
1197
  "autoai-ts_rt24.1-py3.11": "AutoAI",
1198
  "autoai-kb_rt24.1-py3.11": "AutoAI",
1199
+ "runtime-25.1-py3.12": "AI Services/Python Functions/Python Scripts Python 3.12 Runtime",
1200
+ "runtime-24.1-py3.11": "AI Services/Python Functions/Python Scripts Python 3.11 Runtime",
1201
+ "runtime-25.1-py3.12-cuda": "CUDA-enabled (GPU) Python 3.12 Runtime",
1202
+ "runtime-24.1-py3.11-cuda": "CUDA-enabled (GPU) Python 3.11 Runtime",
1203
  "runtime-24.1-r4.3": "R Runtime 4.3",
1204
  "spark-mllib_3.4": "Apache Spark 3.4",
1205
  "autoai-rag_rt24.1-py3.11": "AutoAI RAG",
 
1207
 
1208
  # Define the preferred order for items to appear at the top
1209
  preferred_order = [
1210
+ "runtime-25.1-py3.12",
1211
+ "runtime-25.1-py3.12-cuda",
1212
+ "runtime-25.1-py3.12-xc",
1213
  "runtime-24.1-py3.11",
1214
  "runtime-24.1-py3.11-cuda",
1215
+ "runtime-24.1-py3.11-xc",
1216
  "runtime-24.1-r4.3",
 
1217
  "autoai-rag_rt24.1-py3.11",
1218
  "autoai-ts_rt24.1-py3.11",
1219
  "autoai-kb_rt24.1-py3.11",
1220
  "tensorflow_rt24.1-py3.11",
1221
  "pytorch-onnx_rt24.1-py3.11",
1222
+ "pytorch-onnx_rt25.1-py3.12",
1223
  "onnxruntime_opset_19",
1224
  "spark-mllib_3.4",
1225
  ]
 
1254
  selection_table = mo.ui.table(
1255
  supported_specs,
1256
  selection="single", # Only allow selecting one row
1257
+ label="#### **Select a supported software_spec runtime for your function asset** (For Python Functions select - *'runtime-25.1-py3.12'* ):",
1258
  initial_selection=[
1259
  0
1260
  ], # Now selecting the first row, which should be runtime-24.1-py3.11