Spaces:
Sleeping
Sleeping
Aiswarya Sankar
commited on
Commit
·
154836b
1
Parent(s):
aa9f874
Clean code
Browse files
app.py
CHANGED
@@ -135,14 +135,7 @@ def index_repo(textbox: str, dropdown: str) -> Response:
|
|
135 |
num_workers=12,
|
136 |
runtime = {"tensor_db": True}
|
137 |
)
|
138 |
-
|
139 |
-
# NOTE: This will raise a `deeplake.util.exceptions.LockedException` if dataset is already locked
|
140 |
-
# NOTE: change it to read_only=True when querying the dataset
|
141 |
-
|
142 |
-
# If it is empty, then hydrate otherwise leave it alone
|
143 |
-
print(db)
|
144 |
-
print(db.vectorstore.dataset)
|
145 |
-
print(len(db.vectorstore.dataset))
|
146 |
if db is None or len(db.vectorstore.dataset) == 0:
|
147 |
print("Dataset doesn't exist, fetching data")
|
148 |
try:
|
@@ -173,7 +166,7 @@ def index_repo(textbox: str, dropdown: str) -> Response:
|
|
173 |
for i in range(0, len(texts), 500):
|
174 |
print("Adding documents " + str(i))
|
175 |
db.add_documents(texts[i:i+500])
|
176 |
-
time.sleep(.
|
177 |
|
178 |
except Exception as e:
|
179 |
return Response(
|
@@ -182,13 +175,6 @@ def index_repo(textbox: str, dropdown: str) -> Response:
|
|
182 |
error=str(e),
|
183 |
stdout="",
|
184 |
)
|
185 |
-
# print("Dataset not empty. Deleting existing dataset...")
|
186 |
-
# db.ds.delete()
|
187 |
-
# print("Done.")
|
188 |
-
# # Reinitialize
|
189 |
-
# db = DeepLake(dataset_path=dataset_path,
|
190 |
-
# embedding_function=embeddings,
|
191 |
-
# token=os.environ['ACTIVELOOP_TOKEN'], read_only=False)
|
192 |
|
193 |
except Exception as e:
|
194 |
return Response(
|
|
|
135 |
num_workers=12,
|
136 |
runtime = {"tensor_db": True}
|
137 |
)
|
138 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
if db is None or len(db.vectorstore.dataset) == 0:
|
140 |
print("Dataset doesn't exist, fetching data")
|
141 |
try:
|
|
|
166 |
for i in range(0, len(texts), 500):
|
167 |
print("Adding documents " + str(i))
|
168 |
db.add_documents(texts[i:i+500])
|
169 |
+
time.sleep(.5)
|
170 |
|
171 |
except Exception as e:
|
172 |
return Response(
|
|
|
175 |
error=str(e),
|
176 |
stdout="",
|
177 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
except Exception as e:
|
180 |
return Response(
|