This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pylint: disable=line-too-long | |
""" | |
JCVD Chat 🕺💬 | |
A simple Streamlit app to chat with JCVD (powered by Claude v2) using Amazon Bedrock | |
https://aws.amazon.com/bedrock/claude/ | |
> Adapted from Streamlit's Build conversational apps | |
https://docs.streamlit.io/knowledge-base/tutorials/build-conversational-apps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r""" | |
__ __ ______ _ _ _ | |
| \/ | ____| | | | | | |
| \ / | |__ | |__| | | | |
| |\/| | __| | __ | | | |
| | | | |____| | | |_| | |
|_| |_|______|_| |_(_) My Expert Helper | |
## Overview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG TORCH_VERSION=2.2.1 | |
FROM python:3.12@sha256:35eff340c0acd837b7962f77ee4b8869385dd6fe7d3928375a08f0a3bdd18beb AS basic | |
# Install uv | |
# https://github.com/astral-sh/uv | |
ENV VIRTUAL_ENV=/usr/local | |
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh | |
RUN /install.sh && \ | |
rm install.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r""" | |
____ _ _ | |
| _ \ | | | | | |
| |_) | ___ __| |_ __ ___ ___| | __ | |
| _ < / _ \/ _` | '__/ _ \ / __| |/ / | |
| |_) | __/ (_| | | | (_) | (__| < | |
|____/ \___|\__,_|_| \___/ \___|_|\_\ | |
|_ _| | | (_) | |
| | _ __ | |_ ___ _ ____ ___ _____ _____ _ __ | |
| | | '_ \| __/ _ \ '__\ \ / / |/ _ \ \ /\ / / _ \ '__| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple ConversationalRetrievalChain demo | |
backed by Cohere Embed v3 and Claude 3 Sonnet | |
via Amazon Bedrock 🏔️ | |
""" | |
import os | |
from urllib.request import urlretrieve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r""" | |
Bedrock Scrapper with ScrapeGraphAI | |
/\ \ / /\ | |
//\\ .. //\\ | |
//\(( ))/\\ | |
/ < `' > \ | |
""" | |
import boto3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Describe for Me (Bedrock edition ⛰️) | |
Image ==> Bedrock -> Translate -> Polly ==> Speech | |
""" | |
import argparse | |
import base64 | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install | |
# https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html | |
curl -L https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip -o aws-sam-cli-linux-x86_64.zip | |
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation | |
sudo ./sam-installation/install | |
# Clean | |
rm aws-sam-cli-linux-x86_64.zip | |
rm -rf sam-installation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://rhynorater.github.io/AWS-Metadata-Identity-Credentials | |
token=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \ | |
export AWS_DEFAULT_REGION=`curl -s -H "X-aws-ec2-metadata-token: $token" http://169.254.169.254/latest/meta-data/placement/region` | |
creds=`curl -s -H "X-aws-ec2-metadata-token: $token" http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance/` | |
export AWS_ACCESS_KEY_ID=`echo ${creds} | jq -r .AccessKeyId` | |
export AWS_SECRET_ACCESS_KEY=`echo ${creds} | jq -r .SecretAccessKey` | |
export AWS_SESSION_TOKEN=`echo ${creds} | jq -r .Token` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r""" | |
_____ _ __ __ _ _ _____ _ _ | |
/ ____| | | \/ | | | | / ____| | | | | |
| (___ | | __ _| \ / | |__ __| | __ _ | | | |__ __ _| |_ | |
\___ \| | / _` | |\/| | '_ \ / _` |/ _` | | | | '_ \ / _` | __| | |
____) | |___| (_| | | | | |_) | (_| | (_| | | |____| | | | (_| | |_ | |
|_____/|______\__,_|_| |_|_.__/ \__,_|\__,_| \_____|_| |_|\__,_|\__| | |
""" | |
import os |
OlderNewer