Update main_app.py
Browse files- main_app.py +1 -54
main_app.py
CHANGED
|
@@ -23,6 +23,7 @@ with app.setup:
|
|
| 23 |
cloudant_retrieve_documents,
|
| 24 |
ensure_database_exists,
|
| 25 |
)
|
|
|
|
| 26 |
import marimo as mo
|
| 27 |
import pandas as pd
|
| 28 |
import requests
|
|
@@ -275,60 +276,6 @@ def _(mo, variant_selectors_list):
|
|
| 275 |
|
| 276 |
@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 |
-
def score(input_data):
|
| 282 |
-
original_string = input_data.get("input_data")[0].get("values")[0][0]
|
| 283 |
-
append_string = input_data.get("input_data")[0].get("values")[0][1]
|
| 284 |
-
|
| 285 |
-
hello_world_message = "Hello World + {0}".format(original_string)
|
| 286 |
-
concatenated_string = original_string + append_string
|
| 287 |
-
|
| 288 |
-
score_response = {
|
| 289 |
-
'predictions': [{'fields': ['Response_message_field', 'Random_appended_string'],
|
| 290 |
-
'values': [[hello_world_message, concatenated_string]]
|
| 291 |
-
}]
|
| 292 |
-
}
|
| 293 |
-
return score_response
|
| 294 |
-
return score""",
|
| 295 |
-
"use_cases": ["add_tags"],
|
| 296 |
-
"input_schema": [
|
| 297 |
-
{
|
| 298 |
-
"id": "1",
|
| 299 |
-
"type": "struct",
|
| 300 |
-
"fields": [
|
| 301 |
-
{
|
| 302 |
-
"name": "<variable name 1>",
|
| 303 |
-
"type": "string",
|
| 304 |
-
"nullable": False,
|
| 305 |
-
"metadata": {},
|
| 306 |
-
},
|
| 307 |
-
{
|
| 308 |
-
"name": "<variable name 2>",
|
| 309 |
-
"type": "string",
|
| 310 |
-
"nullable": False,
|
| 311 |
-
"metadata": {},
|
| 312 |
-
},
|
| 313 |
-
],
|
| 314 |
-
}
|
| 315 |
-
],
|
| 316 |
-
"output_schema": [
|
| 317 |
-
{
|
| 318 |
-
"id": "1",
|
| 319 |
-
"type": "struct",
|
| 320 |
-
"fields": [
|
| 321 |
-
{
|
| 322 |
-
"name": "<output return name>",
|
| 323 |
-
"type": "string",
|
| 324 |
-
"nullable": False,
|
| 325 |
-
"metadata": {},
|
| 326 |
-
}
|
| 327 |
-
],
|
| 328 |
-
}
|
| 329 |
-
],
|
| 330 |
-
"dependencies": ["<library_to_add>"],
|
| 331 |
-
}
|
| 332 |
retrieved_template = (
|
| 333 |
cloudant_retrieve_documents(
|
| 334 |
client=cloudant,
|
|
|
|
| 23 |
cloudant_retrieve_documents,
|
| 24 |
ensure_database_exists,
|
| 25 |
)
|
| 26 |
+
from fallback_template import fallback_template
|
| 27 |
import marimo as mo
|
| 28 |
import pandas as pd
|
| 29 |
import requests
|
|
|
|
| 276 |
|
| 277 |
@app.cell
|
| 278 |
def _(cloudant, cloudant_db, template_variant):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
retrieved_template = (
|
| 280 |
cloudant_retrieve_documents(
|
| 281 |
client=cloudant,
|