Update main_app.py
Browse files- main_app.py +8 -19
main_app.py
CHANGED
@@ -55,6 +55,7 @@ def _(mo, get_markdown_content):
|
|
55 |
)
|
56 |
|
57 |
mo.accordion({"## Notebook Introduction": intro})
|
|
|
58 |
|
59 |
|
60 |
@app.cell
|
@@ -116,6 +117,7 @@ def _(client_instantiation_form, os):
|
|
116 |
space_id = None
|
117 |
wx_api_key = None
|
118 |
wx_url = None
|
|
|
119 |
return client_setup, project_id, space_id, wx_api_key, wx_url
|
120 |
|
121 |
|
@@ -221,6 +223,7 @@ def _(
|
|
221 |
deployment_client = None
|
222 |
task_credentials_details = None
|
223 |
client = None
|
|
|
224 |
return client, deployment_client, project_client
|
225 |
|
226 |
|
@@ -258,7 +261,7 @@ def _(cloudant, cloudant_db):
|
|
258 |
)
|
259 |
|
260 |
variant_selectors_list = [item["category"] for item in variant_selectors["docs"]]
|
261 |
-
return variant_selectors_list
|
262 |
|
263 |
|
264 |
@app.cell
|
@@ -274,7 +277,7 @@ def _(mo, variant_selectors_list):
|
|
274 |
def _(cloudant, cloudant_db, template_variant):
|
275 |
fallback_template = {
|
276 |
"function_name": "deployable_function",
|
277 |
-
"function_code":
|
278 |
import subprocess
|
279 |
subprocess.check_output('pip install gensim', shell=True)
|
280 |
import gensim
|
@@ -289,7 +292,8 @@ def _(cloudant, cloudant_db, template_variant):
|
|
289 |
}
|
290 |
return score_response
|
291 |
return score
|
292 |
-
|
|
|
293 |
"use_cases": ["add_tags"],
|
294 |
"input_schema": [
|
295 |
{
|
@@ -705,6 +709,7 @@ def _(template):
|
|
705 |
dependency_pack_name = template["function_name"] + "_dependencies"
|
706 |
# After the yaml_template definition, add:
|
707 |
yaml_templates[dependency_pack_name] = yaml_template
|
|
|
708 |
return (yaml_templates, dependency_pack_name)
|
709 |
|
710 |
|
@@ -1475,22 +1480,6 @@ def _(json, mo, template_variant, template):
|
|
1475 |
|
1476 |
return input_schema, output_schema
|
1477 |
|
1478 |
-
input_schema_editor = mo.ui.code_editor(
|
1479 |
-
value=json.dumps(input_schema, indent=4),
|
1480 |
-
language="python",
|
1481 |
-
min_height=100,
|
1482 |
-
theme="dark",
|
1483 |
-
)
|
1484 |
-
output_schema_editor = mo.ui.code_editor(
|
1485 |
-
value=json.dumps(output_schema, indent=4),
|
1486 |
-
language="python",
|
1487 |
-
min_height=100,
|
1488 |
-
theme="dark",
|
1489 |
-
)
|
1490 |
-
|
1491 |
-
# schema_editors
|
1492 |
-
return input_schema_editor, output_schema_editor
|
1493 |
-
|
1494 |
|
1495 |
@app.cell
|
1496 |
def _(mo, input_schema, output_schema):
|
|
|
55 |
)
|
56 |
|
57 |
mo.accordion({"## Notebook Introduction": intro})
|
58 |
+
return
|
59 |
|
60 |
|
61 |
@app.cell
|
|
|
117 |
space_id = None
|
118 |
wx_api_key = None
|
119 |
wx_url = None
|
120 |
+
|
121 |
return client_setup, project_id, space_id, wx_api_key, wx_url
|
122 |
|
123 |
|
|
|
223 |
deployment_client = None
|
224 |
task_credentials_details = None
|
225 |
client = None
|
226 |
+
|
227 |
return client, deployment_client, project_client
|
228 |
|
229 |
|
|
|
261 |
)
|
262 |
|
263 |
variant_selectors_list = [item["category"] for item in variant_selectors["docs"]]
|
264 |
+
return (variant_selectors_list,)
|
265 |
|
266 |
|
267 |
@app.cell
|
|
|
277 |
def _(cloudant, cloudant_db, template_variant):
|
278 |
fallback_template = {
|
279 |
"function_name": "deployable_function",
|
280 |
+
"function_code": '''def your_function_name():
|
281 |
import subprocess
|
282 |
subprocess.check_output('pip install gensim', shell=True)
|
283 |
import gensim
|
|
|
292 |
}
|
293 |
return score_response
|
294 |
return score
|
295 |
+
|
296 |
+
score = your_function_name()''',
|
297 |
"use_cases": ["add_tags"],
|
298 |
"input_schema": [
|
299 |
{
|
|
|
709 |
dependency_pack_name = template["function_name"] + "_dependencies"
|
710 |
# After the yaml_template definition, add:
|
711 |
yaml_templates[dependency_pack_name] = yaml_template
|
712 |
+
|
713 |
return (yaml_templates, dependency_pack_name)
|
714 |
|
715 |
|
|
|
1480 |
|
1481 |
return input_schema, output_schema
|
1482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
|
1484 |
@app.cell
|
1485 |
def _(mo, input_schema, output_schema):
|