hypeconqueror1 commited on
Commit
bc66bdf
·
verified ·
1 Parent(s): 5a5406f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -2
main.py CHANGED
@@ -2,6 +2,7 @@
2
  from fastapi import FastAPI, File, UploadFile
3
  import os
4
  import shutil
 
5
  import tempfile
6
  from langchain_community.document_loaders import PyMuPDFLoader
7
  from langchain_community.llms import CTransformers
@@ -37,12 +38,13 @@ async def PromptLLM(file: UploadFile = File(...)):
37
  db.save_local(DB_FAISS_PATH)
38
 
39
  # Load the language model
40
- llm = CTransformers(model="llama-2-7b-chat.ggmlv3.q4_1.bin", model_type="llama",config={'max_new_tokens': 1024, 'context_length': 2048, 'temperature': 0.01})
 
41
 
42
  # Create a conversational chain
43
  chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=db.as_retriever())
44
 
45
- result = chain({"question": "Summarise the report", "chat_history": ''})
46
  return result['answer']
47
 
48
 
 
2
  from fastapi import FastAPI, File, UploadFile
3
  import os
4
  import shutil
5
+ from LoadLLM import Loadllm
6
  import tempfile
7
  from langchain_community.document_loaders import PyMuPDFLoader
8
  from langchain_community.llms import CTransformers
 
38
  db.save_local(DB_FAISS_PATH)
39
 
40
  # Load the language model
41
+ # Load the language model
42
+ llm = Loadllm.load_llm()
43
 
44
  # Create a conversational chain
45
  chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=db.as_retriever())
46
 
47
+ result = chain({"question": query, "chat_history": ''})
48
  return result['answer']
49
 
50