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

Add multiple pages #22

Merged
merged 2 commits into from
Dec 12, 2023
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
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ emoji: 📝
colorFrom: red
colorTo: pink
sdk: streamlit
app_file: app.py
app_file: GnosisPages.py
pinned: false
license: mit
---
Expand Down Expand Up @@ -69,7 +69,7 @@ Follow the next steps to set up GnosisPages in your local environment:
```
6. Run on your local environment
```bash
streamlit run app.py
streamlit run GnosisPages.py
```

## Deployment
Expand Down
1 change: 0 additions & 1 deletion gnosis/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def build(key, client):
"""An Agent builder"""
# Build Agent
try:
print(str(st.session_state.temperature))
llm = ChatOpenAI(
temperature=st.session_state.temperature,
model="gpt-3.5-turbo-16k",
Expand Down
10 changes: 5 additions & 5 deletions gnosis/components/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ def delete_collection(client, collection):
"""Delete collection button."""
if st.button("Delete collection"):
st.warning("Are you sure?")
if st.button("Yes"):
try:
client.delete_collection(collection.name)
except AttributeError:
st.error("Collection erased.")
if st.button("Yes"):
try:
client.delete_collection(collection.name)
except AttributeError:
st.error("Collection erased.")


def openai_api_key_box():
Expand Down
33 changes: 33 additions & 0 deletions pages/01_How_to_use.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Instructions on how to use the website"""
import streamlit as st

# Title of the page
st.title("How to use this website")
st.markdown(
"1. **Add your OpenAI API key**: You can get it from [here](https://beta.openai.com/).",
unsafe_allow_html=True,
)
st.image(image="pages/images/01_Add_API_Key.png", caption="Add your OpenAI API key")
st.markdown(
"2. **Upload a PDF file**: It should be a PDF file with text. Scanned pages are not supported."
)
st.image(image="pages/images/02_Upload_PDF.png", caption="Upload a PDF file")
st.markdown(
"3. **Save chunks**: Text is extracted, splitted and save in chunks on ChromaDB."
)
st.image(image="pages/images/03_Save_Chunks.png", caption="Save chunks")
st.markdown(
"4. **Consult your knowledge base**: You can consult your knowledge base with the chatbot."
)
st.image(image="pages/images/04_Consult_KB.png", caption="Consult your knowledge base")
st.markdown(
"5. **Use Wikipedia**: You can use Wikipedia to enrich your knowledge base."
)
st.image(image="pages/images/05_Use_Wikipedia.png", caption="Use Wikipedia")
st.markdown(
'6. **Change creativity level**: Also called "temperature". As higher, more unexpected results.'
)
st.image(image="pages/images/06_Creativity.png", caption="Change creativity level")
st.markdown("7. **Delete collection**: You can delete your collection and start over.")
st.image(image="pages/images/07_Delete_Collection.png", caption="Delete collection")
st.write("That's all! Enjoy!")
19 changes: 19 additions & 0 deletions pages/02_About.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Collection's Page"""
import streamlit as st
import openai
from gnosis.chroma_client import ChromaDB

chroma_db = ChromaDB(openai.api_key)

st.header("About")

# A summary of the project
st.write(
"""
GnosisPages was developed by
[J.P. Pérez Tejada](https://www.linkedin.com/in/juanpaulopereztejada/). December, 2023.


Check the [GitHub repository](https://github.com/maclenn77/pdf-explainer) for more information.
"""
)
Binary file added pages/images/01_Add_API_Key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/images/02_Upload_PDF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/images/03_Save_Chunks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/images/04_Consult_KB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/images/05_Use_Wikipedia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/images/06_Creativity.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/images/07_Delete_Collection.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading