Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,6 +55,9 @@ uploads_dir = os.path.join(app.root_path,'static', 'uploads')
|
|
| 55 |
|
| 56 |
os.makedirs(uploads_dir, exist_ok=True)
|
| 57 |
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
def pretty_print_docs(docs):
|
| 60 |
print(f"\n{'-' * 100}\n".join([f"Document {i + 1}:\n\n" + "Document Length>>>" + str(
|
|
@@ -241,13 +244,20 @@ def process_json():
|
|
| 241 |
def file_Upload():
|
| 242 |
fileprovided = not request.files.getlist('files[]')[0].filename == ''
|
| 243 |
urlProvided = not request.form.getlist('weburl')[0] == ''
|
|
|
|
| 244 |
print("*******")
|
| 245 |
print("File Provided:" + str(fileprovided))
|
| 246 |
print("URL Provided:" + str(urlProvided))
|
|
|
|
| 247 |
print("*******")
|
| 248 |
|
| 249 |
print(uploads_dir)
|
| 250 |
documents = loadKB(fileprovided, urlProvided, uploads_dir, request)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
vectordb=createVectorDB(documents)
|
| 252 |
return render_template("index.html")
|
| 253 |
|
|
|
|
| 55 |
|
| 56 |
os.makedirs(uploads_dir, exist_ok=True)
|
| 57 |
|
| 58 |
+
defaultEmbeddingModelID = 0
|
| 59 |
+
defaultLLMID=0
|
| 60 |
+
|
| 61 |
|
| 62 |
def pretty_print_docs(docs):
|
| 63 |
print(f"\n{'-' * 100}\n".join([f"Document {i + 1}:\n\n" + "Document Length>>>" + str(
|
|
|
|
| 244 |
def file_Upload():
|
| 245 |
fileprovided = not request.files.getlist('files[]')[0].filename == ''
|
| 246 |
urlProvided = not request.form.getlist('weburl')[0] == ''
|
| 247 |
+
embeddingModelProvided = not request.form.getlist('embeddingModelID')[0] == ''
|
| 248 |
print("*******")
|
| 249 |
print("File Provided:" + str(fileprovided))
|
| 250 |
print("URL Provided:" + str(urlProvided))
|
| 251 |
+
print("Embedding Model Provided:" + str(embeddingModelProvided))
|
| 252 |
print("*******")
|
| 253 |
|
| 254 |
print(uploads_dir)
|
| 255 |
documents = loadKB(fileprovided, urlProvided, uploads_dir, request)
|
| 256 |
+
embeddingModelID = defaultEmbeddingModelID
|
| 257 |
+
if embeddingModelProvided:
|
| 258 |
+
embeddingModelID = int(request.form.getlist('embeddingModelID')[0])
|
| 259 |
+
global vectordb
|
| 260 |
+
vectordb = createVectorDB(documents, embeddingModelID)
|
| 261 |
vectordb=createVectorDB(documents)
|
| 262 |
return render_template("index.html")
|
| 263 |
|