mirror of
https://github.com/neuml/txtai.git
synced 2026-10-12 02:19:52 +00:00
Update AWS workflow.py script #228
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
Lambda handler for txtai workflows
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
from txtai.api import API
|
||||
|
||||
APP = None
|
||||
@@ -23,5 +25,8 @@ def handler(event, context):
|
||||
global APP
|
||||
APP = APP if APP else API("config.yml")
|
||||
|
||||
# Get parameters from event body
|
||||
event = json.loads(event["body"])
|
||||
|
||||
# Run workflow and return results
|
||||
return list(APP.workflow(event["name"], event["elements"]))
|
||||
return {"statusCode": 200, "headers": {"Content-Type": "application/json"}, "body": list(APP.workflow(event["name"], event["elements"]))}
|
||||
|
||||
Reference in New Issue
Block a user