maclenn77 commited on
Commit
800aa32
1 Parent(s): 1595682

v. 0.0.1 (#23)

Browse files

* refactor: separate app components

* Add multiple pages (#22)

* Update README.md

app.py → GnosisPages.py RENAMED
@@ -1,3 +1,4 @@
 
1
  """ A Streamlit app for GnosisPages. """
2
  import os
3
  import streamlit as st
 
1
+ # pylint: disable=invalid-name
2
  """ A Streamlit app for GnosisPages. """
3
  import os
4
  import streamlit as st
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 📝
4
  colorFrom: red
5
  colorTo: pink
6
  sdk: streamlit
7
- app_file: app.py
8
  pinned: false
9
  license: mit
10
  ---
@@ -27,6 +27,10 @@ GnosisPages offers you the following key features:
27
 
28
  [Watch a demo here](https://youtu.be/OEQTusJGHFQ)
29
 
 
 
 
 
30
  ## Prerrequisites
31
 
32
  For using the demo, you only need an OpenAI API Key.
@@ -69,7 +73,7 @@ Follow the next steps to set up GnosisPages in your local environment:
69
  ```
70
  6. Run on your local environment
71
  ```bash
72
- streamlit run app.py
73
  ```
74
 
75
  ## Deployment
 
4
  colorFrom: red
5
  colorTo: pink
6
  sdk: streamlit
7
+ app_file: GnosisPages.py
8
  pinned: false
9
  license: mit
10
  ---
 
27
 
28
  [Watch a demo here](https://youtu.be/OEQTusJGHFQ)
29
 
30
+ ## Architecture
31
+
32
+ ![schematic-1](https://github.com/Maclenn77/pdf-explainer/assets/1808402/36dbacfa-43f3-4530-9d31-0e9b1127f992)
33
+
34
  ## Prerrequisites
35
 
36
  For using the demo, you only need an OpenAI API Key.
 
73
  ```
74
  6. Run on your local environment
75
  ```bash
76
+ streamlit run GnosisPages.py
77
  ```
78
 
79
  ## Deployment
gnosis/builder.py CHANGED
@@ -8,7 +8,6 @@ def build(key, client):
8
  """An Agent builder"""
9
  # Build Agent
10
  try:
11
- print(str(st.session_state.temperature))
12
  llm = ChatOpenAI(
13
  temperature=st.session_state.temperature,
14
  model="gpt-3.5-turbo-16k",
 
8
  """An Agent builder"""
9
  # Build Agent
10
  try:
 
11
  llm = ChatOpenAI(
12
  temperature=st.session_state.temperature,
13
  model="gpt-3.5-turbo-16k",
gnosis/components/sidebar.py CHANGED
@@ -8,11 +8,11 @@ def delete_collection(client, collection):
8
  """Delete collection button."""
9
  if st.button("Delete collection"):
10
  st.warning("Are you sure?")
11
- if st.button("Yes"):
12
- try:
13
- client.delete_collection(collection.name)
14
- except AttributeError:
15
- st.error("Collection erased.")
16
 
17
 
18
  def openai_api_key_box():
 
8
  """Delete collection button."""
9
  if st.button("Delete collection"):
10
  st.warning("Are you sure?")
11
+ if st.button("Yes"):
12
+ try:
13
+ client.delete_collection(collection.name)
14
+ except AttributeError:
15
+ st.error("Collection erased.")
16
 
17
 
18
  def openai_api_key_box():
pages/01_How_to_use.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pylint: disable=invalid-name
2
+ """Instructions on how to use the website"""
3
+ import streamlit as st
4
+
5
+ # Title of the page
6
+ st.title("How to use this website")
7
+ st.markdown(
8
+ "1. **Add your OpenAI API key**: You can get it from [here](https://beta.openai.com/).",
9
+ unsafe_allow_html=True,
10
+ )
11
+ st.image(image="pages/images/01_Add_API_Key.png", caption="Add your OpenAI API key")
12
+ st.markdown(
13
+ "2. **Upload a PDF file**: It should be a PDF file with text. Scanned pages are not supported."
14
+ )
15
+ st.image(image="pages/images/02_Upload_PDF.png", caption="Upload a PDF file")
16
+ st.markdown(
17
+ "3. **Save chunks**: Text is extracted, splitted and save in chunks on ChromaDB."
18
+ )
19
+ st.image(image="pages/images/03_Save_Chunks.png", caption="Save chunks")
20
+ st.markdown(
21
+ "4. **Consult your knowledge base**: You can consult your knowledge base with the chatbot."
22
+ )
23
+ st.image(image="pages/images/04_Consult_KB.png", caption="Consult your knowledge base")
24
+ st.markdown(
25
+ "5. **Use Wikipedia**: You can use Wikipedia to enrich your knowledge base."
26
+ )
27
+ st.image(image="pages/images/05_Use_Wikipedia.png", caption="Use Wikipedia")
28
+ st.markdown(
29
+ '6. **Change creativity level**: Also called "temperature". As higher, more unexpected results.'
30
+ )
31
+ st.image(image="pages/images/06_Creativity.png", caption="Change creativity level")
32
+ st.markdown("7. **Delete collection**: You can delete your collection and start over.")
33
+ st.image(image="pages/images/07_Delete_Collection.png", caption="Delete collection")
34
+ st.write("That's all! Enjoy!")
pages/02_About.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pylint: disable=invalid-name
2
+ """Collection's Page"""
3
+ import streamlit as st
4
+ import openai
5
+ from gnosis.chroma_client import ChromaDB
6
+
7
+ chroma_db = ChromaDB(openai.api_key)
8
+
9
+ st.header("About")
10
+
11
+ # A summary of the project
12
+ st.write(
13
+ """
14
+ GnosisPages was developed by
15
+ [J.P. Pérez Tejada](https://www.linkedin.com/in/juanpaulopereztejada/). December, 2023.
16
+
17
+
18
+ Check the [GitHub repository](https://github.com/maclenn77/pdf-explainer) for more information.
19
+ """
20
+ )
pages/images/01_Add_API_Key.png ADDED
pages/images/02_Upload_PDF.png ADDED
pages/images/03_Save_Chunks.png ADDED
pages/images/04_Consult_KB.png ADDED
pages/images/05_Use_Wikipedia.png ADDED
pages/images/06_Creativity.PNG ADDED
pages/images/07_Delete_Collection.PNG ADDED