on1onmangoes commited on
Commit
74b2773
1 Parent(s): 1b0b94c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -27
app.py CHANGED
@@ -127,6 +127,11 @@ def process_pdf(pdf_file, client_name):
127
  def rag_api(question):
128
  return client.predict(question=question, api_name="/run_graph")
129
 
 
 
 
 
 
130
  # CSS for custom styling
131
  CSS = """
132
  # chat-container {
@@ -135,33 +140,6 @@ CSS = """
135
  """
136
 
137
 
138
- def refresh_graph_index(index_name=index_name):
139
- # Check if index exists; if not, create it
140
- if index_name not in pc.list_indexes().names():
141
- pc.create_index(
142
- index_name,
143
- dimension=dimension_embedding_model,
144
- metric='cosine',
145
- spec=spec
146
- )
147
- # Wait for index to be ready
148
- while not pc.describe_index(index_name).status['ready']:
149
- time.sleep(1)
150
-
151
- # Connect to Pinecone index
152
- index = pc.Index(index_name)
153
- text_field = 'content'
154
-
155
- # Initialize Vector Store
156
- vectorstore = LangchainPinecone(
157
- index, embed_model.embed_query, text_field
158
- )
159
- return index, vectorstore
160
-
161
- def delete_index():
162
- client = Client("on1onmangoes/cnianswer101724v3")
163
- result = client.predict(api_name="/delete_index")
164
- return result
165
 
166
 
167
 
 
127
  def rag_api(question):
128
  return client.predict(question=question, api_name="/run_graph")
129
 
130
+ def delete_index():
131
+ client = Client("on1onmangoes/cnianswer101724v3")
132
+ result = client.predict(api_name="/delete_index")
133
+ return result
134
+
135
  # CSS for custom styling
136
  CSS = """
137
  # chat-container {
 
140
  """
141
 
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
 
145