Spaces:
Sleeping
Sleeping
thoristhor
commited on
Commit
•
36ed299
1
Parent(s):
ecd05d8
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import os
|
2 |
from typing import Optional, Tuple
|
3 |
import gradio as gr
|
|
|
4 |
from langchain.vectorstores import Pinecone
|
5 |
|
6 |
|
7 |
# initialize pinecone
|
8 |
-
|
9 |
api_key="PINECONE_API_KEY", # find at app.pinecone.io
|
10 |
environment="PINECONE_ENV" # next to api key in console
|
11 |
)
|
@@ -22,7 +23,6 @@ def set_openai_api_key(api_key: str):
|
|
22 |
if api_key:
|
23 |
os.environ["OPENAI_API_KEY"] = api_key
|
24 |
chain = get_chain(vectorstore)
|
25 |
-
os.environ["OPENAI_API_KEY"] = ""
|
26 |
return chain
|
27 |
|
28 |
class ChatWrapper:
|
|
|
1 |
import os
|
2 |
from typing import Optional, Tuple
|
3 |
import gradio as gr
|
4 |
+
import pinecone
|
5 |
from langchain.vectorstores import Pinecone
|
6 |
|
7 |
|
8 |
# initialize pinecone
|
9 |
+
pinecone.init(
|
10 |
api_key="PINECONE_API_KEY", # find at app.pinecone.io
|
11 |
environment="PINECONE_ENV" # next to api key in console
|
12 |
)
|
|
|
23 |
if api_key:
|
24 |
os.environ["OPENAI_API_KEY"] = api_key
|
25 |
chain = get_chain(vectorstore)
|
|
|
26 |
return chain
|
27 |
|
28 |
class ChatWrapper:
|