mahynski commited on
Commit
7a9e2a5
·
1 Parent(s): 1460b1f

Added reqs and tried it out

Browse files
Files changed (2) hide show
  1. app.py +57 -37
  2. requirements.txt +1 -0
app.py CHANGED
@@ -1,41 +1,61 @@
1
  import streamlit as st
2
 
 
 
3
  st.set_page_config(layout="wide")
4
 
5
- with st.sidebar:
6
- st.title('Document Summarization and QA System')
7
- st.markdown('''
8
- ## About this application
9
- Upload a pdf to ask questions about it. This retrieval-augmented generation (RAG) workflow uses:
10
- - [Streamlit](https://streamlit.io/)
11
- - [LlamaIndex](https://docs.llamaindex.ai/en/stable/)
12
- - [OpenAI](https://platform.openai.com/docs/models)
13
- ''')
14
-
15
- st.write('Made by ***Nate Mahynski***')
16
- st.write('nathan.mahynski@nist.gov')
17
-
18
- # Select Provider
19
- provider = st.selectbox(
20
- label="Select LLM Provider",
21
- options=['openai', 'huggingface'],
22
- index=0
23
- )
24
-
25
- # Select LLM
26
- if provider == 'openai':
27
- llm_list = ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo', 'gpt-4o']
28
- else:
29
- llm_list = []
30
-
31
- llm = st.selectbox(
32
- label="Select LLM Model",
33
- options=llm_list,
34
- index=0
35
- )
36
-
37
- # Enter Token
38
- token = st.text_input(
39
- "Enter your token",
40
- value=None
41
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ from streamlit_pdf_viewer import pdf_viewer
4
+
5
  st.set_page_config(layout="wide")
6
 
7
+ def main():
8
+ with st.sidebar:
9
+ st.title('Document Summarization and QA System')
10
+ # st.markdown('''
11
+ # ## About this application
12
+ # Upload a pdf to ask questions about it. This retrieval-augmented generation (RAG) workflow uses:
13
+ # - [Streamlit](https://streamlit.io/)
14
+ # - [LlamaIndex](https://docs.llamaindex.ai/en/stable/)
15
+ # - [OpenAI](https://platform.openai.com/docs/models)
16
+ # ''')
17
+
18
+ # st.write('Made by ***Nate Mahynski***')
19
+ # st.write('nathan.mahynski@nist.gov')
20
+
21
+ # Select Provider
22
+ provider = st.selectbox(
23
+ label="Select LLM Provider",
24
+ options=['openai', 'huggingface'],
25
+ index=0
26
+ )
27
+
28
+ # Select LLM
29
+ if provider == 'openai':
30
+ llm_list = ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo', 'gpt-4o']
31
+ else:
32
+ llm_list = []
33
+
34
+ llm = st.selectbox(
35
+ label="Select LLM Model",
36
+ options=llm_list,
37
+ index=0
38
+ )
39
+
40
+ # Enter Token
41
+ token = st.text_input(
42
+ "Enter your token",
43
+ value=None
44
+ )
45
+
46
+ uploaded_file = st.file_uploader(
47
+ "Choose a PDF file to upload",
48
+ type=['pdf'],
49
+ accept_multiple_files=False
50
+ )
51
+
52
+ if uploaded_file is not None:
53
+ # Parse the file
54
+ pass
55
+
56
+ col1, col2 = st.columns(2)
57
+
58
+ with col2:
59
+ if uploaded_file is not None:
60
+ # Display the pdf
61
+ pdf_viewer(input=uploaded_file, width=700)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ streamlit-pdf-viewer