updated prompt
Browse files
app.py
CHANGED
@@ -19,6 +19,8 @@ from llama_parse import LlamaParse
|
|
19 |
|
20 |
from streamlit_pdf_viewer import pdf_viewer
|
21 |
|
|
|
|
|
22 |
def main():
|
23 |
with st.sidebar:
|
24 |
st.title('Document Summarization and QA System')
|
@@ -67,7 +69,11 @@ def main():
|
|
67 |
step=0.05,
|
68 |
)
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
71 |
|
72 |
# Enter LLM API Key
|
73 |
llm_key = st.text_input(
|
@@ -84,21 +90,15 @@ def main():
|
|
84 |
Settings.llm = OpenAI(
|
85 |
model=llm_name,
|
86 |
temperature=temperature,
|
87 |
-
max_tokens=
|
88 |
)
|
89 |
Settings.tokenizer = tiktoken.encoding_for_model(llm_name).encode
|
90 |
-
Settings.num_output =
|
91 |
Settings.context_window = 4096 # max possible
|
92 |
Settings.embed_model = OpenAIEmbedding()
|
93 |
elif provider == 'huggingface':
|
94 |
os.environ['HFTOKEN'] = str(llm_key)
|
95 |
|
96 |
-
# Enter Parsing API Key
|
97 |
-
parse_key = st.text_input(
|
98 |
-
"Enter your LlamaParse API Key",
|
99 |
-
value=None,
|
100 |
-
)
|
101 |
-
|
102 |
uploaded_file = st.file_uploader(
|
103 |
"Choose a PDF file to upload",
|
104 |
type=['pdf'],
|
|
|
19 |
|
20 |
from streamlit_pdf_viewer import pdf_viewer
|
21 |
|
22 |
+
MAX_OUTPUT_TOKENS = 2048
|
23 |
+
|
24 |
def main():
|
25 |
with st.sidebar:
|
26 |
st.title('Document Summarization and QA System')
|
|
|
69 |
step=0.05,
|
70 |
)
|
71 |
|
72 |
+
# Enter Parsing API Key
|
73 |
+
parse_key = st.text_input(
|
74 |
+
"Enter your LlamaParse API Key",
|
75 |
+
value=None,
|
76 |
+
)
|
77 |
|
78 |
# Enter LLM API Key
|
79 |
llm_key = st.text_input(
|
|
|
90 |
Settings.llm = OpenAI(
|
91 |
model=llm_name,
|
92 |
temperature=temperature,
|
93 |
+
max_tokens=MAX_OUTPUT_TOKENS
|
94 |
)
|
95 |
Settings.tokenizer = tiktoken.encoding_for_model(llm_name).encode
|
96 |
+
Settings.num_output = MAX_OUTPUT_TOKENS
|
97 |
Settings.context_window = 4096 # max possible
|
98 |
Settings.embed_model = OpenAIEmbedding()
|
99 |
elif provider == 'huggingface':
|
100 |
os.environ['HFTOKEN'] = str(llm_key)
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
uploaded_file = st.file_uploader(
|
103 |
"Choose a PDF file to upload",
|
104 |
type=['pdf'],
|