Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
sudheesh4 authored Dec 11, 2023
1 parent 1e33d2b commit 3f59287
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions App.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from langchain.document_loaders import PyPDFLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings import SentenceTransformerEmbeddings #HuggingFaceInstructEmbeddings
from langchain.vectorstores import FAISS
import os
import copy
import time
import pprint
#import google.generativeai as palm
from langchain.llms import GooglePalm
from langchain import PromptTemplate
from langchain.chains import RetrievalQA

import streamlit
import streamlit.web.cli as stcli

import os,sys
import subprocess
import sentence_transformers
import nltk
import warnings
warnings.filterwarnings("ignore")

def resolve_path(path):
resolved_path = os.path.abspath(os.path.join(os.getcwd(), path))
return resolved_path



while True:
choice=input(f"{'>>'*10} \n Choose : 0-> Ingest ; 1->Query ; 2->Exit \n : ")
if choice=='0':
from ingest import INGESTER
print(f"\n\n{'>>'*10}INGESTING!{'<<'*10}\n")
print("(NOTE: It may take sometime depending on the documents in the data folder. Wait for it to end, it'll inform you of the status.)\n")
print(f"{'###'*20}")
try:
print(f"\n\n{'>>>'*7} Ingesting Files: \n\n")
INGESTER()
print(f"\n\n{'>>'*7}INGESTED! Database ready for query!{'<<'*7}\n\n")
except:
print(f"\n\n{'>>'*7}ERROR OCCURED! Database not created!{'<<'*7}\n\n")
elif choice=='1':
#from docquery import EXTRACT
print("\nSTARTING QUERYING!\n")
try:
sys.argv = [
"streamlit",
"run",
resolve_path("DocChat.py"),
"--global.developmentMode=false",
]
sys.exit(stcli.main())
except:
print("\n\nERROR WHILE INITIATING QUERYING!\n\n")
#EXTRACT()
elif choice=='2':
print("Exiting!")
break
else:
print("Invalid choice!")

0 comments on commit 3f59287

Please sign in to comment.