Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,23 +19,13 @@ from pinecone import Pinecone
|
|
19 |
pc = Pinecone(api_key=os.environ['PINECONE_API_KEY'])
|
20 |
# Define index name and parameters
|
21 |
index_name = "italy-kg"
|
22 |
-
|
23 |
-
# Create index if it doesn't exist
|
24 |
-
if index_name not in existing_indexes:
|
25 |
-
pc.create_index(
|
26 |
-
name=index_name,
|
27 |
-
dimension=1536,
|
28 |
-
metric="cosine",
|
29 |
-
spec=ServerlessSpec(
|
30 |
-
cloud="aws",
|
31 |
-
region="us-east-1"
|
32 |
-
),
|
33 |
-
deletion_protection="disabled"
|
34 |
-
)
|
35 |
|
36 |
# Embedding using OpenAI
|
37 |
embeddings = OpenAIEmbeddings(api_key=openai_api_key)
|
38 |
|
|
|
|
|
39 |
# Gradio Blocks app with PDF uploader and table for logs
|
40 |
def process_pdf(file):
|
41 |
# Extract text from PDF using pdfplumber
|
|
|
19 |
pc = Pinecone(api_key=os.environ['PINECONE_API_KEY'])
|
20 |
# Define index name and parameters
|
21 |
index_name = "italy-kg"
|
22 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
# Embedding using OpenAI
|
25 |
embeddings = OpenAIEmbeddings(api_key=openai_api_key)
|
26 |
|
27 |
+
vectorstore = PineconeVectorStore(index_name=index_name, embedding=embeddings)
|
28 |
+
|
29 |
# Gradio Blocks app with PDF uploader and table for logs
|
30 |
def process_pdf(file):
|
31 |
# Extract text from PDF using pdfplumber
|