Update app.py
Browse files
app.py
CHANGED
@@ -6,8 +6,6 @@ from langchain.chains.question_answering import load_qa_chain
|
|
6 |
from langchain_openai import OpenAI
|
7 |
import gradio as gr
|
8 |
|
9 |
-
openai_api_key = "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"
|
10 |
-
|
11 |
# Function to read text from a file
|
12 |
def read_txt(file_path):
|
13 |
with open(file_path, "r") as file:
|
@@ -24,7 +22,7 @@ user_query = read_txt(text_file_path)
|
|
24 |
char_text_splitter = CharacterTextSplitter(separator="\n", chunk_size=1000, chunk_overlap=200, length_function=len)
|
25 |
text_chunks = char_text_splitter.split_text(user_query)
|
26 |
|
27 |
-
embeddings = OpenAIEmbeddings()
|
28 |
docsearch = FAISS.from_texts(text_chunks, embeddings)
|
29 |
|
30 |
llm = OpenAI()
|
|
|
6 |
from langchain_openai import OpenAI
|
7 |
import gradio as gr
|
8 |
|
|
|
|
|
9 |
# Function to read text from a file
|
10 |
def read_txt(file_path):
|
11 |
with open(file_path, "r") as file:
|
|
|
22 |
char_text_splitter = CharacterTextSplitter(separator="\n", chunk_size=1000, chunk_overlap=200, length_function=len)
|
23 |
text_chunks = char_text_splitter.split_text(user_query)
|
24 |
|
25 |
+
embeddings = OpenAIEmbeddings(openai_api_key="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")
|
26 |
docsearch = FAISS.from_texts(text_chunks, embeddings)
|
27 |
|
28 |
llm = OpenAI()
|