Skip to content

Commit

Permalink
Merge branch 'main' into refactor-and-add-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
neal-logan authored Nov 24, 2024
2 parents a65243d + 13d745d commit 82a48b7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 37 deletions.
27 changes: 27 additions & 0 deletions MinuteMate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@

##### Setup - Docker

In MinuteMate/back:

Set up secrets in a .env file according to .env.example

```bash
docker compose --env-file .env up -d --build
```

In MinuteMate/front:

```bash
docker compose up -d --build
```


##### Setup - Repo

**Front-End
```
cd /MinuteMate/front/
streamlit run app.py
```

**Back-End
```
cd /MinuteMate/back/
uvicorn main02:app --reload
```


6 changes: 6 additions & 0 deletions MinuteMate/back/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#OPENAI API KEY
OPENAI_API_KEY =

# Weaviate cloud deployment
WEAVIATE_URL =
WEAVIATE_API_KEY =
1 change: 1 addition & 0 deletions MinuteMate/back/main_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def process_prompt(prompt_request: PromptRequest) -> PromptResponse:
return prompt_response






Expand Down
2 changes: 1 addition & 1 deletion MinuteMate/front/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ COPY . /app
RUN pip install --upgrade pip
RUN python -m pip install -r requirements.txt
EXPOSE 8501
CMD ["streamlit", "run","app.py"]
CMD ["streamlit", "run","app.py"]
39 changes: 3 additions & 36 deletions MinuteMate/front/app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# from st_weaviate_connection import WeaviateConnection
import streamlit as st
import time
import os
import requests

from dotenv import load_dotenv

# st.set_page_config(layout="wide")

Expand All @@ -20,24 +16,8 @@
# )


# load_dotenv()

# ENV_VARS = ["WEAVIATE_URL", "WEAVIATE_API_KEY", "OPENAI_KEY"]
NUM_IMAGES_PER_ROW = 3

# def get_env_vars(env_vars: list) -> dict:
# """Retrieve environment variables."""
# env_vars_dict = {}
# for var in ENV_VARS:
# value = os.environ.get(var, "")
# if value == "":
# st.error(f"{var} not set", icon="🚨")
# st.stop()
# env_vars_dict[var] = value

# return env_vars_dict


def display_chat_messages() -> None:
"""Display chat message history."""
for message in st.session_state.messages:
Expand All @@ -50,24 +30,12 @@ def display_chat_messages() -> None:
if i + j < len(message["images"]):
cols[j].image(message["images"][i + j], width=200)

# env_vars = get_env_vars(ENV_VARS)
# url = env_vars["WEAVIATE_URL"]
# api_key = env_vars["WEAVIATE_API_KEY"]
# openai_key = env_vars["OPENAI_KEY"]

st.title("📝 Minute Mate")

# conn = st.connection(
# "weaviate",
# type=WeaviateConnection,
# url=url,
# api_key=api_key,
# additional_headers={"X-OpenAI-Api-Key": openai_key},
# )

with st.sidebar:

st.sidebar.image("./../../assets/Fun_Logo.jpg", width=150)
# TODO add image to app assets to deploy
# st.sidebar.image("./../../assets/Fun_Logo.jpg", width=150)
st.subheader("Speeding up Municipal Communication")

st.header("Settings")
Expand Down Expand Up @@ -144,7 +112,6 @@ def display_chat_messages() -> None:
button_pressed = example_prompts[5]



if prompt := (st.chat_input("Type your prompt") or button_pressed):
with st.chat_message("user"):
st.markdown(prompt)
Expand All @@ -153,7 +120,7 @@ def display_chat_messages() -> None:
try:
# Make API call to backend
response = requests.post(
"http://localhost:8000/process-prompt", # Adjust URL as needed
"http://host.docker.internal:8001/process-prompt", # Adjust URL as needed
json={"user_prompt_text": prompt}
)

Expand Down

0 comments on commit 82a48b7

Please sign in to comment.