Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpreetbedi committed Jan 29, 2024
1 parent 4a3025b commit 08c2762
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
## AI Cookbook
# AI Cookbook

This repo contains a collection of AI recipes/patterns built using [phidata](https://github.com/phidatahq/phidata)

- [Full documentation](https://docs.phidata.com/ai-cookbook)

## Run locally using docker
## Live Demos

### Setup
The AI cookbook apps are live and can be accessed at:

- <a href="https://hn.aidev.run/" target="_blank" rel="noopener noreferrer">HackerNews AI</a> that interacts with the HN API to summarize stories, users, find out what's trending, summarize topics.
- <a href="https://demo.aidev.run/" target="_blank" rel="noopener noreferrer">Streamlit App</a> serving a PDF, Image and Website Assistant (password: admin)
- <a href="https://api.aidev.run/docs" target="_blank" rel="noopener noreferrer">FastApi </a> serving a PDF Assistant.

## Setup

1. Clone the git repo

Expand Down Expand Up @@ -37,37 +43,44 @@ phi ws setup
cp -r workspace/example_secrets workspace/secrets
```

6. Optional: Create `.env` file:
6. Copy `.env` file:

```sh
cp example.env .env
```

### Run Cookbook locally
7. Update `.env` file:

1. Install [docker desktop](https://www.docker.com/products/docker-desktop)
- Set the AI apps like `HACKERNEWS_AI` you'd like to enable as True
- Set your `OPENAI_API_KEY`

2. Set OpenAI Key
```sh
HACKERNEWS_AI=True
# OPENAI_API_KEY=sk-***
```

Set the `OPENAI_API_KEY` environment variable using
- You can also export these as environment variable like:

```sh
export OPENAI_API_KEY=sk-***
```

**OR** set in the `.env` file
## Run AI Cookbook locally

1. Install [docker desktop](https://www.docker.com/products/docker-desktop)

3. Start the workspace using:
2. Start the workspace using:

```sh
phi ws up
```

- Open [localhost:8501](http://localhost:8501) to view the Streamlit App.
- Open [localhost:8000/docs](http://localhost:8000/docs) to view the FastApi docs.
- If HackerNews AI is enabled, open [localhost:8502](http://localhost:8502) to view HackerNews AI.
- If Jupyter is enabled, open [localhost:8888](http://localhost:8888) to view JupyterLab UI.

4. Stop the workspace using:
3. Stop the workspace using:

```sh
phi ws down
Expand Down
1 change: 1 addition & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
HACKERNEWS_AI=True
# IMAGE_REPO=repo
# BUILD_IMAGES=True
# PUSH_IMAGES=True
Expand Down
1 change: 1 addition & 0 deletions workspace/dev_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
hn_ai = Streamlit(
name=f"hn-{ws_settings.ws_name}",
image=dev_image,
enabled=getenv("HACKERNEWS_AI", False),
command="streamlit run hn_ai/app.py",
host_port=8502,
container_port=8501,
Expand Down
1 change: 1 addition & 0 deletions workspace/prd_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
# -*- HN AI running on ECS
hn_ai = Streamlit(
name=f"hn-{ws_settings.ws_name}",
enabled=getenv("HACKERNEWS_AI", False),
group="hn",
image=prd_image,
command="streamlit run hn_ai/app.py",
Expand Down

0 comments on commit 08c2762

Please sign in to comment.