Tonic commited on
Commit
26f734b
1 Parent(s): 4f12271

add environemnt variable

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -16,7 +16,10 @@ from chromadb.config import Settings
16
  from chromadb import HttpClient
17
  from utils import load_env_variables, parse_and_route
18
  from globalvars import API_BASE, intention_prompt, tasks, system_message, model_name
19
-
 
 
 
20
  os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:30'
21
  os.environ['CUDA_LAUNCH_BLOCKING'] = '1'
22
  os.environ['CUDA_CACHE_DISABLE'] = '1'
@@ -94,7 +97,7 @@ def load_documents(file_path: str, mode: str = "elements"):
94
  return [doc.page_content for doc in docs]
95
 
96
  def initialize_chroma(collection_name: str, embedding_function: MyEmbeddingFunction):
97
- client = chromadb.HttpClient(host='localhost', port=8000, settings = Settings(allow_reset=True, anonymized_telemetry=False))
98
  client.reset() # resets the database
99
  collection = client.create_collection(collection_name)
100
  return client, collection
 
16
  from chromadb import HttpClient
17
  from utils import load_env_variables, parse_and_route
18
  from globalvars import API_BASE, intention_prompt, tasks, system_message, model_name
19
+ from dotenv import load_dotenv
20
+
21
+ load_dotenv()
22
+
23
  os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:30'
24
  os.environ['CUDA_LAUNCH_BLOCKING'] = '1'
25
  os.environ['CUDA_CACHE_DISABLE'] = '1'
 
97
  return [doc.page_content for doc in docs]
98
 
99
  def initialize_chroma(collection_name: str, embedding_function: MyEmbeddingFunction):
100
+ client = HttpClient(host='localhost', port=8000, settings = Settings(allow_reset=True, anonymized_telemetry=False))
101
  client.reset() # resets the database
102
  collection = client.create_collection(collection_name)
103
  return client, collection