Samarth991 commited on
Commit
3edae51
1 Parent(s): 1c52547

adding online PDF loader

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -44,17 +44,17 @@ def chat_application(llm_service,key):
44
  llm_model = get_openai_chat_model(API_key=key)
45
 
46
 
47
- def document_loader(file_data,api_key,doc_type='pdf',llm='Huggingface'):
48
  embedding_model = SentenceTransformerEmbeddings(model_name='all-mpnet-base-v2',model_kwargs={"device": DEVICE})
49
  document = None
50
  if doc_type == 'pdf':
51
- document = process_pdf_document(document_file=file_data)
52
  elif doc_type == 'text':
53
- document = process_text_document(document_file=file_data)
54
  elif doc_type == 'csv':
55
- document = process_csv_document(document_file=file_data)
56
  elif doc_type == 'word':
57
- document = process_word_document(document_file=file_data)
58
  if document:
59
  texts = process_documents(documents=document)
60
  vector_db = FAISS.from_documents(documents=texts, embedding= embedding_model)
 
44
  llm_model = get_openai_chat_model(API_key=key)
45
 
46
 
47
+ def document_loader(file_path,api_key,doc_type='pdf',llm='Huggingface'):
48
  embedding_model = SentenceTransformerEmbeddings(model_name='all-mpnet-base-v2',model_kwargs={"device": DEVICE})
49
  document = None
50
  if doc_type == 'pdf':
51
+ document = process_pdf_document(document_file=file_path)
52
  elif doc_type == 'text':
53
+ document = process_text_document(document_file=file_path)
54
  elif doc_type == 'csv':
55
+ document = process_csv_document(document_file=file_path)
56
  elif doc_type == 'word':
57
+ document = process_word_document(document_file=file_path)
58
  if document:
59
  texts = process_documents(documents=document)
60
  vector_db = FAISS.from_documents(documents=texts, embedding= embedding_model)