Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,10 +21,11 @@ load_dotenv()
|
|
| 21 |
def get_stored_files():
|
| 22 |
"""Retrieve a list of files currently stored in the Pinecone index using the pinecone library."""
|
| 23 |
try:
|
| 24 |
-
|
|
|
|
| 25 |
index_name = os.environ.get("PINECONE_INDEX_NAME")
|
| 26 |
|
| 27 |
-
print(PINECONE_API_KEY,
|
| 28 |
# Check if the index exists. If not, there are no files.
|
| 29 |
if index_name not in [index_info["name"] for index_info in pc.list_indexes()]:
|
| 30 |
return []
|
|
|
|
| 21 |
def get_stored_files():
|
| 22 |
"""Retrieve a list of files currently stored in the Pinecone index using the pinecone library."""
|
| 23 |
try:
|
| 24 |
+
PINECONE_API_KEY = os.environ.get("PINECONE_API_KEY")
|
| 25 |
+
pc = Pinecone(api_key=PINECONE_API_KEY)
|
| 26 |
index_name = os.environ.get("PINECONE_INDEX_NAME")
|
| 27 |
|
| 28 |
+
print(PINECONE_API_KEY, index_name)
|
| 29 |
# Check if the index exists. If not, there are no files.
|
| 30 |
if index_name not in [index_info["name"] for index_info in pc.list_indexes()]:
|
| 31 |
return []
|