Upload app.py
Browse files
app.py
CHANGED
|
@@ -23,10 +23,6 @@ from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
|
| 23 |
|
| 24 |
st.title("ChatPDF")
|
| 25 |
|
| 26 |
-
st.markdown("""
|
| 27 |
-
ChatPDF is a web application that can answer questions based on a PDF document. To use the app, simply upload a PDF file and type your question in the input box. The app will then use a powerful language model to generate an answer to your question.
|
| 28 |
-
""")
|
| 29 |
-
|
| 30 |
# Create a visual separator in the app.
|
| 31 |
st.write("---")
|
| 32 |
|
|
@@ -99,7 +95,7 @@ if uploaded_file is not None:
|
|
| 99 |
stream_hander = StreamHandler(chat_box)
|
| 100 |
|
| 101 |
# Initialize the Q&A model and chain.
|
| 102 |
-
llm = CTransformers(model="llama-2-7b-chat
|
| 103 |
qa_chain = RetrievalQA.from_chain_type(llm, retriever=db.as_retriever())
|
| 104 |
# Get the answer to the user's question.
|
| 105 |
qa_chain({"query": question})
|
|
|
|
| 23 |
|
| 24 |
st.title("ChatPDF")
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
# Create a visual separator in the app.
|
| 27 |
st.write("---")
|
| 28 |
|
|
|
|
| 95 |
stream_hander = StreamHandler(chat_box)
|
| 96 |
|
| 97 |
# Initialize the Q&A model and chain.
|
| 98 |
+
llm = CTransformers(model="meta-llama/Llama-2-7b-chat-hf", model_type="llama", callbacks=[stream_hander])
|
| 99 |
qa_chain = RetrievalQA.from_chain_type(llm, retriever=db.as_retriever())
|
| 100 |
# Get the answer to the user's question.
|
| 101 |
qa_chain({"query": question})
|