This is a Generative AI and a large language model (LLM) application showcase using Amazon Bedrock, Python, and AWS CDK. It contains the source code of a sample web application for teachers to create course materials and for students, to learn English words and sentences.
What can teachers do using the web application?
- Create questions from a sentence using a large language model
- Create an image based on the sentence using a text-to-image model
- Save the sentence, the generated questions, and the generated image into an assignment bank
- Browse assignments, generated questions, and generated images from the assignment bank
What can students do using the web application?
- Select and review an assignment from the assignment bank
- Provide answers to the questions for the selected assignment
- See the grading scores of the answers generated by an NLP model
- Check the suggested word improvements generated by an NLP model
- Check the suggested sentence improvements generated by an NLP model
The cdk.json
file tells the CDK Toolkit how to execute your app.
This project is set up like a standard Python project. The initialization
process also creates a virtualenv within this project, stored under the .venv
directory. To create the virtualenv it assumes that there is a python3
(or python
for Windows) executable in your path with access to the venv
package. If for any reason the automatic creation of the virtualenv fails,
you can create the virtualenv manually.
To manually create a virtualenv on MacOS and Linux:
$ python3 -m venv .venv
After the init process completes and the virtualenv is created, you can use the following step to activate your virtualenv.
$ source .venv/bin/activate
If you are a Windows platform, you would activate the virtualenv like this:
% .venv\Scripts\activate.bat
Once the virtualenv is activated, you can install the required dependencies.
$ pip install -r requirements.txt
You need to install and start docker on your MacOS.
You also need to configure the application by setting two parameters in the parameters.json:
- s3_bucket_name: your S3 bucket to save the images generated by large language model.
- ai21_api_key: API Key for your ai21.com account.
At this point you can now synthesize the CloudFormation template for this code.
$ cdk synth
cdk ls
list all stacks in the appcdk synth
emits the synthesized CloudFormation templatecdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk docs
open CDK documentation
Enjoy!