Update app.py
Browse files
app.py
CHANGED
|
@@ -35,13 +35,13 @@ def download_paper_and_embed(paper_arxiv_url, api_key):
|
|
| 35 |
else:
|
| 36 |
raise ValueError("Invalid arXiv URL")
|
| 37 |
suffix = 'paper-dir/' + eprint_url.replace("https://arxiv.org/e-print/", "")
|
|
|
|
| 38 |
if not os.path.exists(suffix + "/docs.index"):
|
| 39 |
create_vector_store(suffix, paper_text)
|
| 40 |
|
| 41 |
-
|
| 42 |
vectorstore = get_vectorstore(suffix)
|
| 43 |
qa_chain = VectorDBQAWithSourcesChain.from_llm(llm=OpenAI(temperature=0), vectorstore=vectorstore)
|
| 44 |
-
os.environ["OPENAI_API_KEY"] = ""
|
| 45 |
return qa_chain
|
| 46 |
|
| 47 |
chain = None
|
|
|
|
| 35 |
else:
|
| 36 |
raise ValueError("Invalid arXiv URL")
|
| 37 |
suffix = 'paper-dir/' + eprint_url.replace("https://arxiv.org/e-print/", "")
|
| 38 |
+
os.environ["OPENAI_API_KEY"] = api_key
|
| 39 |
if not os.path.exists(suffix + "/docs.index"):
|
| 40 |
create_vector_store(suffix, paper_text)
|
| 41 |
|
| 42 |
+
|
| 43 |
vectorstore = get_vectorstore(suffix)
|
| 44 |
qa_chain = VectorDBQAWithSourcesChain.from_llm(llm=OpenAI(temperature=0), vectorstore=vectorstore)
|
|
|
|
| 45 |
return qa_chain
|
| 46 |
|
| 47 |
chain = None
|