singhjagpreet commited on
Commit
4a5ab79
β€’
1 Parent(s): a554da2
Files changed (3) hide show
  1. Dockerfile +15 -0
  2. README.md +9 -0
  3. app.py +6 -2
Dockerfile ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ WORKDIR /app
4
+
5
+
6
+ COPY /src /app/src
7
+ COPY requirements.txt /app/.
8
+ COPY app.py /app/.
9
+ COPY chainlit.md /app/.
10
+ COPY .env /app/.
11
+
12
+ RUN pip install -r requirements.txt
13
+
14
+ CMD ["chainlit", "run", "app.py"]
15
+
README.md CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  # Document Reader
2
 
3
  Don't waste time reading lengthy Terms and Conditions! Upload your files here and ask anything you want to know.
 
1
+ ---
2
+ title: DR
3
+ emoji: πŸ“š
4
+ colorFrom: red
5
+ colorTo: blue
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
  # Document Reader
11
 
12
  Don't waste time reading lengthy Terms and Conditions! Upload your files here and ask anything you want to know.
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import logging
3
 
 
4
 
5
  #export HNSWLIB_NO_NATIVE = 1
6
 
@@ -12,12 +13,17 @@ from langchain.memory import ChatMessageHistory, ConversationBufferMemory
12
  from langchain.chains import ConversationalRetrievalChain
13
  from langchain.chat_models import ChatOpenAI
14
  import chainlit as cl
 
15
  from src.config import Config
16
  from src.utils import get_docsearch, get_source
17
 
18
  # text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
19
  # embeddings = OpenAIEmbeddings()
20
 
 
 
 
 
21
  welcome_message = """Welcome to Your Document Reader!
22
 
23
  Here to assist you with any questions you have about a file. You can upload a file and ask me questions related to its content. Here's how you can get started:
@@ -99,8 +105,6 @@ async def main(message: cl.Message):
99
 
100
  answer = res["answer"]
101
  source_documents = res["source_documents"]
102
-
103
-
104
 
105
  text_elements = get_source(answer, source_documents)
106
  await cl.Message(content=answer, elements=text_elements).send()
 
1
  import os
2
  import logging
3
 
4
+ # from dotenv import load_dotenv
5
 
6
  #export HNSWLIB_NO_NATIVE = 1
7
 
 
13
  from langchain.chains import ConversationalRetrievalChain
14
  from langchain.chat_models import ChatOpenAI
15
  import chainlit as cl
16
+ import openai
17
  from src.config import Config
18
  from src.utils import get_docsearch, get_source
19
 
20
  # text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
21
  # embeddings = OpenAIEmbeddings()
22
 
23
+ # load_dotenv()
24
+ # OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
25
+
26
+
27
  welcome_message = """Welcome to Your Document Reader!
28
 
29
  Here to assist you with any questions you have about a file. You can upload a file and ask me questions related to its content. Here's how you can get started:
 
105
 
106
  answer = res["answer"]
107
  source_documents = res["source_documents"]
 
 
108
 
109
  text_elements = get_source(answer, source_documents)
110
  await cl.Message(content=answer, elements=text_elements).send()