Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from llama_parse import LlamaParse
|
| 3 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
@@ -8,13 +9,9 @@ from langchain.prompts import PromptTemplate
|
|
| 8 |
from langchain.chains import RetrievalQA
|
| 9 |
from langchain_groq import ChatGroq
|
| 10 |
import joblib
|
| 11 |
-
import os
|
| 12 |
import tempfile
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
st.title("Uber Quarterly Report QA")
|
| 16 |
-
|
| 17 |
-
# Access API keys from secrets
|
| 18 |
llama_cloud_api_key = "llx-rVenNfvEyWTTZ2bOJIY7zymr6oyyucfdBusq407A6RzZhMKb"
|
| 19 |
groq_api_key = "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"
|
| 20 |
|
|
@@ -37,6 +34,9 @@ uploaded_file = st.file_uploader("Upload a PDF file", type="pdf")
|
|
| 37 |
if uploaded_file is not None:
|
| 38 |
llama_parse_documents = load_or_parse_data(uploaded_file)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
| 40 |
# Further processing of the parsed data...
|
| 41 |
# Further processing of the parsed data
|
| 42 |
with open('data/output.md', 'a') as f:
|
|
|
|
| 1 |
+
import os
|
| 2 |
import streamlit as st
|
| 3 |
from llama_parse import LlamaParse
|
| 4 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
|
| 9 |
from langchain.chains import RetrievalQA
|
| 10 |
from langchain_groq import ChatGroq
|
| 11 |
import joblib
|
|
|
|
| 12 |
import tempfile
|
| 13 |
|
| 14 |
+
# API keys
|
|
|
|
|
|
|
|
|
|
| 15 |
llama_cloud_api_key = "llx-rVenNfvEyWTTZ2bOJIY7zymr6oyyucfdBusq407A6RzZhMKb"
|
| 16 |
groq_api_key = "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"
|
| 17 |
|
|
|
|
| 34 |
if uploaded_file is not None:
|
| 35 |
llama_parse_documents = load_or_parse_data(uploaded_file)
|
| 36 |
|
| 37 |
+
# Create data directory if it doesn't exist
|
| 38 |
+
os.makedirs("data", exist_ok=True)
|
| 39 |
+
|
| 40 |
# Further processing of the parsed data...
|
| 41 |
# Further processing of the parsed data
|
| 42 |
with open('data/output.md', 'a') as f:
|