diff --git a/app.py b/GnosisPages.py similarity index 100% rename from app.py rename to GnosisPages.py diff --git a/README.md b/README.md index 2649f2e..6c87078 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ emoji: šŸ“ colorFrom: red colorTo: pink sdk: streamlit -app_file: app.py +app_file: GnosisPages.py pinned: false license: mit --- @@ -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 diff --git a/gnosis/builder.py b/gnosis/builder.py index 7798b11..4203515 100644 --- a/gnosis/builder.py +++ b/gnosis/builder.py @@ -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", diff --git a/gnosis/components/sidebar.py b/gnosis/components/sidebar.py index e5d3da8..32b4be6 100644 --- a/gnosis/components/sidebar.py +++ b/gnosis/components/sidebar.py @@ -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(): diff --git a/pages/01_How_to_use.py b/pages/01_How_to_use.py new file mode 100644 index 0000000..f35978c --- /dev/null +++ b/pages/01_How_to_use.py @@ -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!") diff --git a/pages/02_About.py b/pages/02_About.py new file mode 100644 index 0000000..478155b --- /dev/null +++ b/pages/02_About.py @@ -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. + """ +) diff --git a/pages/images/01_Add_API_Key.png b/pages/images/01_Add_API_Key.png new file mode 100644 index 0000000..c1d70cc Binary files /dev/null and b/pages/images/01_Add_API_Key.png differ diff --git a/pages/images/02_Upload_PDF.png b/pages/images/02_Upload_PDF.png new file mode 100644 index 0000000..79af441 Binary files /dev/null and b/pages/images/02_Upload_PDF.png differ diff --git a/pages/images/03_Save_Chunks.png b/pages/images/03_Save_Chunks.png new file mode 100644 index 0000000..a2e51c1 Binary files /dev/null and b/pages/images/03_Save_Chunks.png differ diff --git a/pages/images/04_Consult_KB.png b/pages/images/04_Consult_KB.png new file mode 100644 index 0000000..d6c8b51 Binary files /dev/null and b/pages/images/04_Consult_KB.png differ diff --git a/pages/images/05_Use_Wikipedia.png b/pages/images/05_Use_Wikipedia.png new file mode 100644 index 0000000..328947e Binary files /dev/null and b/pages/images/05_Use_Wikipedia.png differ diff --git a/pages/images/06_Creativity.PNG b/pages/images/06_Creativity.PNG new file mode 100644 index 0000000..2ac1b73 Binary files /dev/null and b/pages/images/06_Creativity.PNG differ diff --git a/pages/images/07_Delete_Collection.PNG b/pages/images/07_Delete_Collection.PNG new file mode 100644 index 0000000..1addf32 Binary files /dev/null and b/pages/images/07_Delete_Collection.PNG differ