Spaces:
Sleeping
Sleeping
Update UI and cleanup. Update demo screenshot.
Browse files- README.md +1 -0
- app.py +5 -5
- 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 |
-
|
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="
|
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 |
-
"
|
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("
|
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=
|
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