petrojm commited on
Commit
e18dfac
1 Parent(s): 883864f

changes to app and config

Browse files
Files changed (2) hide show
  1. app.py +1 -10
  2. config.yaml +2 -2
app.py CHANGED
@@ -10,9 +10,6 @@ from src.document_retrieval import DocumentRetrieval
10
  from utils.parsing.sambaparse import parse_doc_universal # added
11
  from utils.vectordb.vector_db import VectorDb
12
 
13
- CONFIG_PATH = os.path.join(current_dir,'config.yaml')
14
- PERSIST_DIRECTORY = os.path.join(current_dir,f"data/my-vector-db") # changed to current_dir
15
-
16
  def handle_userinput(user_question, conversation_chain, history):
17
  if user_question:
18
  try:
@@ -46,12 +43,6 @@ def process_documents(files, collection_name, document_retrieval, vectorstore, c
46
  except Exception as e:
47
  return conversation_chain, vectorstore, document_retrieval, collection_name, f"An error occurred while processing: {str(e)}"
48
 
49
- # Read config file
50
- with open(CONFIG_PATH, 'r') as yaml_file:
51
- config = yaml.safe_load(yaml_file)
52
-
53
- prod_mode = config.get('prod_mode', False)
54
-
55
  caution_text = """⚠️ Note: depending on the size of your document, this could take several minutes.
56
  """
57
 
@@ -66,7 +57,7 @@ with gr.Blocks() as demo:
66
 
67
  gr.Markdown("Powered by LLama3.1-8B-Instruct on SambaNova Cloud. Get your API key [here](https://cloud.sambanova.ai/apis).")
68
 
69
- #api_key = gr.Textbox(label="API Key", type="password", placeholder="(Optional) Enter your API key here for more availability")
70
 
71
  # Step 1: Add PDF file
72
  gr.Markdown("## 1️⃣ Upload PDF")
 
10
  from utils.parsing.sambaparse import parse_doc_universal # added
11
  from utils.vectordb.vector_db import VectorDb
12
 
 
 
 
13
  def handle_userinput(user_question, conversation_chain, history):
14
  if user_question:
15
  try:
 
43
  except Exception as e:
44
  return conversation_chain, vectorstore, document_retrieval, collection_name, f"An error occurred while processing: {str(e)}"
45
 
 
 
 
 
 
 
46
  caution_text = """⚠️ Note: depending on the size of your document, this could take several minutes.
47
  """
48
 
 
57
 
58
  gr.Markdown("Powered by LLama3.1-8B-Instruct on SambaNova Cloud. Get your API key [here](https://cloud.sambanova.ai/apis).")
59
 
60
+ api_key = gr.Textbox(label="API Key", type="password", placeholder="(Optional) Enter your API key here for more availability")
61
 
62
  # Step 1: Add PDF file
63
  gr.Markdown("## 1️⃣ Upload PDF")
config.yaml CHANGED
@@ -1,9 +1,9 @@
1
  api: "sncloud" # set either sambastudio or sncloud
2
 
3
  embedding_model:
4
- "type": "cpu" # set either sambastudio or cpu
5
  "batch_size": 1 #set depending of your endpoint configuration (1 if CoE embedding expert)
6
- "coe": True #set true if using Sambastudio embeddings in a CoE endpoint
7
  "select_expert": "e5-mistral-7b-instruct" #set if using SambaStudio CoE embedding expert
8
 
9
  llm:
 
1
  api: "sncloud" # set either sambastudio or sncloud
2
 
3
  embedding_model:
4
+ "type": "sambastudio" # set either sambastudio or cpu
5
  "batch_size": 1 #set depending of your endpoint configuration (1 if CoE embedding expert)
6
+ "coe": False #set true if using Sambastudio embeddings in a CoE endpoint
7
  "select_expert": "e5-mistral-7b-instruct" #set if using SambaStudio CoE embedding expert
8
 
9
  llm: