Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerize Llamarine Agent #385

Merged
merged 7 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/llamarine/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md
.env
21 changes: 21 additions & 0 deletions examples/llamarine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Use an official Python runtime as a base image
FROM python:3.12-slim

# Set the working directory
WORKDIR /app

# Install git and any other system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends git=1:2.39.5-0+deb12u1 && rm -rf /var/lib/apt/lists/*

# Copy the requirements file and install dependencies
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . /app

# Expose Streamlit port
EXPOSE 8501

# Run the Streamlit app
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]
2 changes: 1 addition & 1 deletion examples/llamarine/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
streamlit-run:
@poetry run streamlit run streamlit-main.py --server.allowRunOnSave=true --server.runOnSave=true
@poetry run streamlit run app.py --server.allowRunOnSave=true --server.runOnSave=true
38 changes: 35 additions & 3 deletions examples/llamarine/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
<!-- markdownlint-disable MD043 -->

# Maritime-Specific Agents leveraging Open-Source `Llamarine` LM
# Maritime-Specific Agent

## Streamlit App
This app serves as a proof of concept (PoC) for a maritime-specific AI agent
leveraging [Domain-Aware Neurosymbolic Agent (DANA)](https://arxiv.org/abs/2410.02823) architecture to address and solve
collision avoidance problems in marine navigation.

Run by `make streamlit-run`
## Usage

```shell
make streamlit-run
```

## Running with Docker

If you prefer to run the app in a Docker container, follow these steps:

### Prerequisites

- Docker installed on your machine.

### Building the Docker Image

```shell
docker build -t dana-llamarine .
```

### Running the Docker Container

#### Running the container

```shell
docker run --name llamarine-test --rm -p 8501:8501 -e .env dana-llamarine
```

#### Access the app

[http://localhost:8501](http://localhost:8501)
21 changes: 11 additions & 10 deletions examples/llamarine/streamlit-main.py → examples/llamarine/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@
if 'typed_problem' not in st.session_state:
st.session_state.typed_problem: str = DEFAULT_PROBLEM

st.session_state.typed_problem: str = st.text_area(label='Problem/Question',
value=st.session_state.typed_problem,
height=3,
max_chars=None,
key=None,
help='Problem/Question',
on_change=None, args=None, kwargs=None,
placeholder='Problem/Question',
disabled=False,
label_visibility='collapsed')
st.session_state.typed_problem: str = st.text_area(
label='Problem/Question',
value=st.session_state.typed_problem,
max_chars=None,
key=None,
help='Problem/Question',
on_change=None, args=None, kwargs=None,
placeholder='Problem/Question',
disabled=False,
label_visibility='collapsed'
)

if 'agent_solutions' not in st.session_state:
st.session_state.agent_solutions: defaultdict[str, str] = defaultdict(str)
Expand Down
2 changes: 1 addition & 1 deletion examples/llamarine/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ IF "%TARGET%"=="streamlit-run" GOTO streamlit-run
:: STREAMLIT APP
:: =============
:streamlit-run
poetry run streamlit run streamlit-main.py --server.allowRunOnSave=true --server.runOnSave=true
poetry run streamlit run app.py --server.allowRunOnSave=true --server.runOnSave=true
GOTO end


Expand Down
2 changes: 2 additions & 0 deletions examples/llamarine/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
streamlit>=1.40.0
git+https://github.com/aitomatic/openssa.git@0.24.10.26