Joshua Sundance Bailey
commited on
Commit
·
67e3a9b
1
Parent(s):
9578b22
python:3.11-slim-bookworm
Browse files- Dockerfile +1 -1
- README.md +16 -30
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
FROM python:3.11-slim-
|
2 |
|
3 |
RUN adduser --uid 1000 --disabled-password --gecos '' appuser
|
4 |
USER 1000
|
|
|
1 |
+
FROM python:3.11-slim-bookworm
|
2 |
|
3 |
RUN adduser --uid 1000 --disabled-password --gecos '' appuser
|
4 |
USER 1000
|
README.md
CHANGED
@@ -46,12 +46,24 @@ This `README` was written by [Claude 2](https://www.anthropic.com/index/claude-2
|
|
46 |
- Integrates with [LangSmith](https://smith.langchain.com) for tracing conversations
|
47 |
- Allows giving feedback on assistant's responses
|
48 |
- Tries reading API keys and default values from environment variables
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
# Usage
|
51 |
## Run on HuggingFace Spaces
|
52 |
[![Open HuggingFace Space](https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg)](https://huggingface.co/spaces/joshuasundance/langchain-streamlit-demo)
|
53 |
|
54 |
## With Docker (pull from Docker Hub)
|
|
|
55 |
1. _Optional_: Create a `.env` file based on `.env-example`
|
56 |
2. Run in terminal:
|
57 |
|
@@ -61,9 +73,9 @@ or
|
|
61 |
|
62 |
`docker run -p 7860:7860 --env-file .env joshuasundance/langchain-streamlit-demo:latest`
|
63 |
|
64 |
-
|
65 |
|
66 |
-
## Docker Compose
|
67 |
1. Clone the repo. Navigate to cloned repo directory
|
68 |
2. _Optional_: Create a `.env` file based on `.env-example`
|
69 |
3. Run in terminal:
|
@@ -74,8 +86,7 @@ or
|
|
74 |
|
75 |
`docker compose up --env-file env`
|
76 |
|
77 |
-
4.
|
78 |
-
5. Open http://localhost:7860 in your browser
|
79 |
|
80 |
## Kubernetes
|
81 |
1. Clone the repo. Navigate to cloned repo directory
|
@@ -83,28 +94,6 @@ or
|
|
83 |
3. Run in terminal: `cd kubernetes && kubectl apply -f resources.yaml`
|
84 |
4. Get the IP address for your new service: `kubectl get service langchain-streamlit-demo`
|
85 |
|
86 |
-
# Configuration
|
87 |
-
- Select a model from the dropdown
|
88 |
-
- _Optional_: Create a `.env` file based on `.env-example`, or
|
89 |
-
- Enter an API key for the relevant provider
|
90 |
-
- Optionally enter a LangSmith API key to enable conversation tracing
|
91 |
-
- Customize the assistant prompt and temperature
|
92 |
-
|
93 |
-
# Code Overview
|
94 |
-
- `langchain-streamlit-demo/app.py` - Main Streamlit app definition
|
95 |
-
- `langchain-streamlit-demo/llm_stuff.py` - LangChain helper functions
|
96 |
-
- `Dockerfile`, `docker-compose.yml`: Docker deployment
|
97 |
-
- `kubernetes/`: Kubernetes deployment files
|
98 |
-
- `.github/workflows/`: CI/CD workflows
|
99 |
-
|
100 |
-
# Deployment
|
101 |
-
The app is packaged as a Docker image for easy deployment. It is published to Docker Hub and Hugging Face Spaces:
|
102 |
-
|
103 |
-
- [DockerHub](https://hub.docker.com/r/joshuasundance/langchain-streamlit-demo)
|
104 |
-
- [HuggingFace Spaces](https://huggingface.co/spaces/joshuasundance/langchain-streamlit-demo)
|
105 |
-
|
106 |
-
CI/CD workflows in `.github/workflows` handle building and publishing the image.
|
107 |
-
|
108 |
# Links
|
109 |
- [Streamlit](https://streamlit.io)
|
110 |
- [LangChain](https://langchain.com)
|
@@ -112,6 +101,3 @@ CI/CD workflows in `.github/workflows` handle building and publishing the image.
|
|
112 |
- [OpenAI](https://openai.com/)
|
113 |
- [Anthropic](https://www.anthropic.com/)
|
114 |
- [Anyscale Endpoints](https://endpoints.anyscale.com/)
|
115 |
-
|
116 |
-
# TODO
|
117 |
-
1. More customization / parameterization in sidebar
|
|
|
46 |
- Integrates with [LangSmith](https://smith.langchain.com) for tracing conversations
|
47 |
- Allows giving feedback on assistant's responses
|
48 |
- Tries reading API keys and default values from environment variables
|
49 |
+
- Parameters in sidebar can be customized
|
50 |
+
|
51 |
+
# Code Overview
|
52 |
+
- `langchain-streamlit-demo/app.py` - Main Streamlit app definition
|
53 |
+
- `langchain-streamlit-demo/llm_stuff.py` - LangChain helper functions
|
54 |
+
- `Dockerfile`, `docker-compose.yml`: Docker deployment
|
55 |
+
- `kubernetes/`: Kubernetes deployment files
|
56 |
+
- `.github/workflows/`: CI/CD workflows
|
57 |
+
|
58 |
+
# Deployment
|
59 |
+
`langchain-streamlit-demo` is deployed as a [Docker image](https://hub.docker.com/r/joshuasundance/langchain-streamlit-demo) based on the [`python:3.11-slim-bookworm`](https://github.com/docker-library/python/blob/81b6e5f0643965618d633cd6b811bf0879dee360/3.11/slim-bookworm/Dockerfile) image.
|
60 |
+
CI/CD workflows in `.github/workflows` handle building and publishing the image as well as pushing it to Hugging Face.
|
61 |
|
|
|
62 |
## Run on HuggingFace Spaces
|
63 |
[![Open HuggingFace Space](https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg)](https://huggingface.co/spaces/joshuasundance/langchain-streamlit-demo)
|
64 |
|
65 |
## With Docker (pull from Docker Hub)
|
66 |
+
|
67 |
1. _Optional_: Create a `.env` file based on `.env-example`
|
68 |
2. Run in terminal:
|
69 |
|
|
|
73 |
|
74 |
`docker run -p 7860:7860 --env-file .env joshuasundance/langchain-streamlit-demo:latest`
|
75 |
|
76 |
+
3. Open http://localhost:7860 in your browser
|
77 |
|
78 |
+
## Docker Compose (build locally)
|
79 |
1. Clone the repo. Navigate to cloned repo directory
|
80 |
2. _Optional_: Create a `.env` file based on `.env-example`
|
81 |
3. Run in terminal:
|
|
|
86 |
|
87 |
`docker compose up --env-file env`
|
88 |
|
89 |
+
4. Open http://localhost:7860 in your browser
|
|
|
90 |
|
91 |
## Kubernetes
|
92 |
1. Clone the repo. Navigate to cloned repo directory
|
|
|
94 |
3. Run in terminal: `cd kubernetes && kubectl apply -f resources.yaml`
|
95 |
4. Get the IP address for your new service: `kubectl get service langchain-streamlit-demo`
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
# Links
|
98 |
- [Streamlit](https://streamlit.io)
|
99 |
- [LangChain](https://langchain.com)
|
|
|
101 |
- [OpenAI](https://openai.com/)
|
102 |
- [Anthropic](https://www.anthropic.com/)
|
103 |
- [Anyscale Endpoints](https://endpoints.anyscale.com/)
|
|
|
|
|
|