File tree Expand file tree Collapse file tree 1 file changed +10
-19
lines changed
sample-applications/simple-client-server Expand file tree Collapse file tree 1 file changed +10
-19
lines changed Original file line number Diff line number Diff line change 11# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22# SPDX-License-Identifier: Apache-2.0
33import boto3
4- import json
5- from flask import Flask
4+ from flask import Flask , request
5+
6+ # Let's use Amazon S3
7+ s3 = boto3 .resource ("s3" )
68
7- client = boto3 .client (service_name = "bedrock-runtime" )
89app = Flask (__name__ )
910
11+
1012@app .route ("/server_request" )
1113def server_request ():
12- messages = [
13- {"role" : "user" , "content" : [{"text" : "Write a short poem" }]},
14- ]
15-
16- model_response = client .converse (
17- modelId = "us.amazon.nova-lite-v1:0" ,
18- messages = messages
19- )
20-
21- print ("\n [Full Response]" )
22- print (json .dumps (model_response , indent = 2 ))
23-
24- print ("\n [Response Content Text]" )
25- print (model_response ["output" ]["message" ]["content" ][0 ]["text" ])
26-
14+ print (request .args .get ("param" ))
15+ for bucket in s3 .buckets .all ():
16+ print (bucket .name )
17+ return "served"
2718
2819
2920if __name__ == "__main__" :
30- app .run (port = 8082 )
21+ app .run (port = 8082 )
You can’t perform that action at this time.
0 commit comments