- Newest
- Most votes
- Most comments
To pass multiple prompts to your AWS Lambda function for Nova Reels multi-shots, you can modify your Kotlin code to include multiple prompts in the JSON payload. Here's how you can adjust your code to pass two prompts:
-
First, ensure you have two input fields or a way to capture two separate prompts from the user.
-
Then, modify your code to create a JSON payload with both prompts:
val userPrompt1 = inputField1.text.toString() val userPrompt2 = inputField2.text.toString() val jsonPayload = """ { "prompt1": "$userPrompt1", "prompt2": "$userPrompt2" } """.trimIndent() val requestBody = jsonPayload.toRequestBody("application/json".toMediaType()) val request = Request.Builder() .url(url) .post(requestBody) .build()
In your AWS Lambda function, you can then retrieve these prompts from the event parameter:
def lambda_handler(event, context): # Extract the prompts from the event body = json.loads(event['body']) prompt1 = body['prompt1'] prompt2 = body['prompt2'] model_input = { "taskType": "TEXT_VIDEO", "textToVideoParams": [ {"text": prompt1}, {"text": prompt2} ], "videoGenerationConfig": { "durationSeconds": 6, "fps": 24, "dimension": "1280x720", "seed": 33, }, } # Rest of your Lambda function code...
This approach allows you to send multiple prompts from your Android app to your Lambda function, which can then use them for the Nova Reels multi-shot feature. Remember to adjust the Lambda function to handle multiple prompts in the textToVideoParams section of the model_input dictionary.
Sources
Changing AWS Lambda Function prompt value with an event instead of changing environment variable. | AWS re:Post
i need to pass an event with my string, to my AWS Lambda function, to use as the prompt to communicate with amazon bedrock. | AWS re:Post
Relevant content
asked a year ago
asked a year ago
- AWS OFFICIALUpdated 6 months ago
