Spaces:
Running
Running
Commit
·
37c7e44
1
Parent(s):
8c5d334
Finalised TXT and PDF files
Browse files
app.py
CHANGED
|
@@ -22,7 +22,6 @@ from langchain.document_loaders import UnstructuredPDFLoader
|
|
| 22 |
|
| 23 |
os.environ["HUGGINGFACEHUB_API_TOKEN"] = st.secrets["hf_api_key"]
|
| 24 |
|
| 25 |
-
|
| 26 |
def init():
|
| 27 |
global embeddings, llm, llm2, chain
|
| 28 |
# Embeddings
|
|
@@ -102,32 +101,4 @@ with st.sidebar.expander('File'):
|
|
| 102 |
if (uploaded_file):
|
| 103 |
st.info(uploaded_file.name)
|
| 104 |
if os.path.exists('/content/'):
|
| 105 |
-
st.info(os.listdir('/content/'))
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
# # PDFs
|
| 109 |
-
# # !wget https://github.com/fabiomatricardi/cdQnA/raw/main/PLC_mediumArticle.pdf
|
| 110 |
-
# # !wget https://github.com/fabiomatricardi/cdQnA/raw/main/BridgingTheGaap_fromMedium.pdf
|
| 111 |
-
# # !mkdir pdfs
|
| 112 |
-
# # !cp *pdf '/content/pdfs'
|
| 113 |
-
|
| 114 |
-
# # pdf_folder_path = '/content/pdfs'
|
| 115 |
-
# # os.listdir(pdf_folder_path)
|
| 116 |
-
|
| 117 |
-
# # loaders = [UnstructuredPDFLoader(os.path.join(pdf_folder_path, fn)) for fn in os.listdir(pdf_folder_path)]
|
| 118 |
-
# # loaders
|
| 119 |
-
|
| 120 |
-
# index = VectorstoreIndexCreator(
|
| 121 |
-
# embedding=HuggingFaceEmbeddings(),
|
| 122 |
-
# text_splitter=CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)).from_loaders(loaders)
|
| 123 |
-
|
| 124 |
-
# #Load llm with selected one
|
| 125 |
-
# llm2=HuggingFaceHub(repo_id="declare-lab/flan-alpaca-large", model_kwargs={"temperature":0, "max_length":512})
|
| 126 |
-
# #Prepare the pipeline
|
| 127 |
-
# from langchain.chains import RetrievalQA
|
| 128 |
-
# chain = RetrievalQA.from_chain_type(llm=llm2,
|
| 129 |
-
# chain_type="stuff",
|
| 130 |
-
# retriever=index.vectorstore.as_retriever(),
|
| 131 |
-
# input_key="question")
|
| 132 |
-
# #get reply to our questions
|
| 133 |
-
# # chain.run('What is the difference between a PLC and a PC?')
|
|
|
|
| 22 |
|
| 23 |
os.environ["HUGGINGFACEHUB_API_TOKEN"] = st.secrets["hf_api_key"]
|
| 24 |
|
|
|
|
| 25 |
def init():
|
| 26 |
global embeddings, llm, llm2, chain
|
| 27 |
# Embeddings
|
|
|
|
| 101 |
if (uploaded_file):
|
| 102 |
st.info(uploaded_file.name)
|
| 103 |
if os.path.exists('/content/'):
|
| 104 |
+
st.info(os.listdir('/content/'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|