updated prompt
Browse files
app.py
CHANGED
|
@@ -98,6 +98,9 @@ def main():
|
|
| 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",
|
|
@@ -123,6 +126,18 @@ def main():
|
|
| 123 |
|
| 124 |
col1, col2 = st.columns(2)
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
with col1:
|
| 127 |
st.markdown(
|
| 128 |
"""
|
|
@@ -152,18 +167,6 @@ def main():
|
|
| 152 |
response = query_engine.query(prompt)
|
| 153 |
st.write(response.response)
|
| 154 |
|
| 155 |
-
with col2:
|
| 156 |
-
tab1, tab2 = st.tabs(["Uploaded File", "Parsed File",])
|
| 157 |
-
|
| 158 |
-
with tab1:
|
| 159 |
-
if uploaded_file is not None: # Display the pdf
|
| 160 |
-
bytes_data = uploaded_file.getvalue()
|
| 161 |
-
pdf_viewer(input=bytes_data, width=700)
|
| 162 |
-
|
| 163 |
-
with tab2:
|
| 164 |
-
if parsed_document is not None: # Showed the raw parsing result
|
| 165 |
-
st.write(parsed_document)
|
| 166 |
-
|
| 167 |
if __name__ == '__main__':
|
| 168 |
# Global configurations
|
| 169 |
from llama_index.core import set_global_handler
|
|
|
|
| 98 |
Settings.embed_model = OpenAIEmbedding()
|
| 99 |
elif provider == 'huggingface':
|
| 100 |
os.environ['HFTOKEN'] = str(llm_key)
|
| 101 |
+
raise NotImplementedError(f"{provider} is not supported yet")
|
| 102 |
+
else:
|
| 103 |
+
raise NotImplementedError(f"{provider} is not supported yet")
|
| 104 |
|
| 105 |
uploaded_file = st.file_uploader(
|
| 106 |
"Choose a PDF file to upload",
|
|
|
|
| 126 |
|
| 127 |
col1, col2 = st.columns(2)
|
| 128 |
|
| 129 |
+
with col2:
|
| 130 |
+
tab1, tab2 = st.tabs(["Uploaded File", "Parsed File",])
|
| 131 |
+
|
| 132 |
+
with tab1:
|
| 133 |
+
if uploaded_file is not None: # Display the pdf
|
| 134 |
+
bytes_data = uploaded_file.getvalue()
|
| 135 |
+
pdf_viewer(input=bytes_data, width=700)
|
| 136 |
+
|
| 137 |
+
with tab2:
|
| 138 |
+
if parsed_document is not None: # Showed the raw parsing result
|
| 139 |
+
st.write(parsed_document)
|
| 140 |
+
|
| 141 |
with col1:
|
| 142 |
st.markdown(
|
| 143 |
"""
|
|
|
|
| 167 |
response = query_engine.query(prompt)
|
| 168 |
st.write(response.response)
|
| 169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
if __name__ == '__main__':
|
| 171 |
# Global configurations
|
| 172 |
from llama_index.core import set_global_handler
|