vinhnx90 commited on
Commit
5df5027
β€’
1 Parent(s): f57788d

Update UI and cleanup. Update demo screenshot.

Browse files
Files changed (3) hide show
  1. README.md +1 -0
  2. app.py +5 -5
  3. img/screenshot.jpg +0 -0
README.md CHANGED
@@ -6,6 +6,7 @@ The app allows users to upload documents (PDFs or text files), and then ask ques
6
 
7
  ---
8
 
 
9
  ![Demo Screenshot](./img/screenshot.jpg)
10
 
11
  ---
 
6
 
7
  ---
8
 
9
+ Running RAG to ask question about certain information inside the Document. For this demo, I use asked the model about the [How to Build Your Career in AI](https://info.deeplearning.ai/how-to-build-a-career-in-ai-book) PDF from Andrew Ng.
10
  ![Demo Screenshot](./img/screenshot.jpg)
11
 
12
  ---
app.py CHANGED
@@ -26,7 +26,7 @@ def load_and_process_file(file_data):
26
  with open(file_name, "wb") as f:
27
  f.write(file_data.getvalue())
28
 
29
- name, extension = os.path.splitext(file_name)
30
 
31
  # Load the file using the appropriate loader
32
  if extension == ".pdf":
@@ -67,13 +67,13 @@ def main():
67
  """
68
  The main function that runs the Streamlit app.
69
  """
70
- st.set_page_config(page_title="Chat with Document", page_icon="πŸ“š")
71
 
72
  st.title("πŸ“š InkChatGPT")
73
  st.write("Upload a document and ask questions related to its content.")
74
 
75
  uploaded_file = st.file_uploader(
76
- "Upload a file", type=["pdf", "docx", "txt"], key="file_uploader"
77
  )
78
 
79
  if uploaded_file:
@@ -84,7 +84,7 @@ def main():
84
  )
85
 
86
  if uploaded_file and add_file:
87
- with st.spinner("Processing file..."):
88
  vector_store = load_and_process_file(uploaded_file)
89
  if vector_store:
90
  crc = initialize_chat_model(vector_store)
@@ -94,7 +94,7 @@ def main():
94
  st.markdown("## Ask a Question")
95
  question = st.text_area(
96
  "Enter your question",
97
- height=200,
98
  key="question_input",
99
  )
100
  submit_button = st.button("Submit", key="submit_button")
 
26
  with open(file_name, "wb") as f:
27
  f.write(file_data.getvalue())
28
 
29
+ _, extension = os.path.splitext(file_name)
30
 
31
  # Load the file using the appropriate loader
32
  if extension == ".pdf":
 
67
  """
68
  The main function that runs the Streamlit app.
69
  """
70
+ st.set_page_config(page_title="InkChatGPT", page_icon="πŸ“š")
71
 
72
  st.title("πŸ“š InkChatGPT")
73
  st.write("Upload a document and ask questions related to its content.")
74
 
75
  uploaded_file = st.file_uploader(
76
+ "Select a file", type=["pdf", "docx", "txt"], key="file_uploader"
77
  )
78
 
79
  if uploaded_file:
 
84
  )
85
 
86
  if uploaded_file and add_file:
87
+ with st.spinner("πŸ’­ Thinking..."):
88
  vector_store = load_and_process_file(uploaded_file)
89
  if vector_store:
90
  crc = initialize_chat_model(vector_store)
 
94
  st.markdown("## Ask a Question")
95
  question = st.text_area(
96
  "Enter your question",
97
+ height=93,
98
  key="question_input",
99
  )
100
  submit_button = st.button("Submit", key="submit_button")
img/screenshot.jpg CHANGED