Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,11 +3,10 @@ import streamlit as st
|
|
3 |
import pickle
|
4 |
from PyPDF2 import PdfReader
|
5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
6 |
-
from
|
7 |
from langchain.vectorstores import FAISS
|
8 |
from langchain.llms import HuggingFace
|
9 |
from langchain.chains.question_answering import load_qa_chain
|
10 |
-
from langchain.callbacks import get_openai_callback
|
11 |
import os
|
12 |
|
13 |
# Load environment variables from .env file
|
@@ -57,9 +56,7 @@ def main():
|
|
57 |
model_name = "distilbert-base-uncased-distilled-squad" # Example model
|
58 |
llm = HuggingFace(model_name=model_name)
|
59 |
chain = load_qa_chain(llm=llm, chain_type="stuff")
|
60 |
-
|
61 |
-
response = chain.run(input_documents=docs, question=query)
|
62 |
-
print(cb)
|
63 |
st.write(response)
|
64 |
|
65 |
if __name__ == '__main__':
|
|
|
3 |
import pickle
|
4 |
from PyPDF2 import PdfReader
|
5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
6 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
7 |
from langchain.vectorstores import FAISS
|
8 |
from langchain.llms import HuggingFace
|
9 |
from langchain.chains.question_answering import load_qa_chain
|
|
|
10 |
import os
|
11 |
|
12 |
# Load environment variables from .env file
|
|
|
56 |
model_name = "distilbert-base-uncased-distilled-squad" # Example model
|
57 |
llm = HuggingFace(model_name=model_name)
|
58 |
chain = load_qa_chain(llm=llm, chain_type="stuff")
|
59 |
+
response = chain.run(input_documents=docs, question=query)
|
|
|
|
|
60 |
st.write(response)
|
61 |
|
62 |
if __name__ == '__main__':
|