Skip to content

Commit 53fec6a

Browse files
committed
Update
1 parent f8fc839 commit 53fec6a

File tree

6 files changed

+23
-36
lines changed

6 files changed

+23
-36
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77

88
使用該工具至少須具備 `openai_api_key`,有關如何取得 key 可以前往[連結](https://platform.openai.com/)
99

10+
## How to develope a docGPT with streamlit?
11+
12+
[Tutorial](./tutorial/)
13+
14+
15+
1016
## Introduction
1117

1218
* `docGPT` 是基於 langchain 與 streamlit 開發的

app.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,23 @@
2020
SERPAPI_API_KEY = ''
2121
agent_ = None
2222

23-
st.set_page_config(page_title="DocGPT")
24-
icon, title = st.columns([3, 20])
25-
with icon:
26-
st.image('./img/chatbot.png')
27-
with title:
28-
st.title('PDF Chatbot')
2923
st.session_state.openai_api_key = None
3024
st.session_state.serpapi_api_key = None
3125

3226

27+
def theme():
28+
st.set_page_config(page_title="DocGPT")
29+
30+
icon, title = st.columns([3, 20])
31+
with icon:
32+
st.image('./img/chatbot.png')
33+
with title:
34+
st.title('PDF Chatbot')
35+
36+
37+
theme()
38+
39+
3340
def load_api_key() -> None:
3441
with st.sidebar:
3542

docGPT/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
from .docGPT import DocGPT
2-
from .response_processor import (
3-
JSONProcessor,
4-
slice_list,
5-
)

model/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from .data_connection import (
2-
JSONWriter,
32
PDFLoader
43
)

model/data_connection.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,3 @@ def split_documents(
3535
)
3636

3737
return splitter.split_documents(document)
38-
39-
40-
class JSONWriter:
41-
def __init__(self, file_name: str) -> None:
42-
self.file_name = file_name
43-
44-
def writer(self, data: list) -> None:
45-
if os.path.exists(self.file_name):
46-
with open(self.file_name) as file:
47-
listObj = json.load(file)
48-
49-
listObj.extend(data)
50-
data = listObj
51-
52-
with open(self.file_name, 'w') as file:
53-
json.dump(
54-
data,
55-
file,
56-
indent=4
57-
)
58-
59-
60-
class LoggerHandle:
61-
def qa_chain(self, chain_type: str, retriever, llm):
62-
pass

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
langchain==0.0.222
2+
openai==0.27.8
3+
streamlit==1.22.0
4+
pymupdf

0 commit comments

Comments
 (0)