Spaces:
Build error
Build error
Update app.py
Browse files95 unmodified lines9697989910010110210310410510610710810911011111211311411511611795 unmodified lines# Initialize databasedef initialize_database(list_file_obj, chunk_size, chunk_overlap, progress=gr.Progress()):# Create list of documents (when valid)#file_path = file_obj.namelist_file_path = [x.name for x in list_file_obj if x is not None]collection_name = Path(list_file_path[0]).stemprint('list_file_path: ', list_file_path)print('Collection name: ', collection_name)progress(0.25, desc="Loading document...")# Load document and create splitsdoc_splits = load_doc(list_file_path, chunk_size, chunk_overlap)# Create or load Vector databaseprogress(0.5, desc="Generating vector database...")# global vector_db#vector_db = create_db(doc_splits, collection_name)vector_db = load_db()progress(0.9, desc="Done!")return vector_db, collection_name, "Complete!"def initialize_LLM(llm_option, llm_temperature, max_tokens, top_k, vector_db, progress=gr.Progress()):95 unmodified lines9697989910010110210310410510610710810911011111211311411511611711811912095 unmodified lines# Initialize databasedef initialize_database(list_file_obj, chunk_size, chunk_overlap, progress=gr.Progress()):CreaDB = Falseif CreaDB:list_file_path = [x.name for x in list_file_obj if x is not None]collection_name = Path(list_file_path[0]).stemprint('list_file_path: ', list_file_path)print('Collection name: ', collection_name)progress(0.25, desc="Loading document...")# Load document and create splitsdoc_splits = load_doc(list_file_path, chunk_size, chunk_overlap)# Create or load Vector databaseprogress(0.5, desc="Generating vector database...")# global vector_dbvector_db = create_db(doc_splits, collection_name)progress(0.9, desc="Done!")return vector_db, collection_name, "Complete!"else:collection_name = 'Documenti'vector_db = load_db()return vector_db, collection_name, "Complete!"def initialize_LLM(llm_option, llm_temperature, max_tokens, top_k, vector_db, progress=gr.Progress()):
app.py+19-16