mtyrrell commited on
Commit
019f514
·
1 Parent(s): ecc8726

ts startup

Browse files
Files changed (4) hide show
  1. app/main.py +1 -2
  2. app/nodes.py +13 -0
  3. app/utils.py +2 -0
  4. requirements.txt +1 -0
app/main.py CHANGED
@@ -1,5 +1,4 @@
1
  #CHATFED_ORCHESTRATOR
2
-
3
  import gradio as gr
4
  from fastapi import FastAPI, UploadFile, File, Form, Request
5
  from fastapi.responses import StreamingResponse
@@ -318,7 +317,7 @@ workflow.add_edge("geojson_direct", END)
318
 
319
  compiled_graph = workflow.compile()
320
 
321
- # TODO: PROBABLY REMOVE - NON-STREAMING VERSION
322
  def process_query_core(
323
  query: str,
324
  reports_filter: str = "",
 
1
  #CHATFED_ORCHESTRATOR
 
2
  import gradio as gr
3
  from fastapi import FastAPI, UploadFile, File, Form, Request
4
  from fastapi.responses import StreamingResponse
 
317
 
318
  compiled_graph = workflow.compile()
319
 
320
+ # NON-STREAMING VERSION
321
  def process_query_core(
322
  query: str,
323
  reports_filter: str = "",
app/nodes.py CHANGED
@@ -5,9 +5,22 @@ import tempfile
5
  import os
6
  from gradio_client import Client, file
7
  import logging
 
8
 
9
  logger = logging.getLogger(__name__)
10
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  # CORE PROCESSING NODES
12
  #----------------------------------------
13
  # File type detection node
 
5
  import os
6
  from gradio_client import Client, file
7
  import logging
8
+ from utils import getconfig
9
 
10
  logger = logging.getLogger(__name__)
11
 
12
+ config = getconfig("params.cfg")
13
+ RETRIEVER = config.get("retriever", "RETRIEVER", fallback="https://giz-chatfed-retriever.hf.space")
14
+ GENERATOR = config.get("generator", "GENERATOR", fallback="https://giz-chatfed-generator.hf.space")
15
+ INGESTOR = config.get("ingestor", "INGESTOR", fallback="https://mtyrrell-chatfed-ingestor.hf.space")
16
+ GEOJSON_INGESTOR = config.get("ingestor", "GEOJSON_INGESTOR", fallback="https://giz-eudr-chatfed-ingestor.hf.space")
17
+ MAX_CONTEXT_CHARS = config.get("general", "MAX_CONTEXT_CHARS")
18
+
19
+ ingestor_url = INGESTOR
20
+ retriever_url = RETRIEVER
21
+ generator_url = GENERATOR
22
+ geojson_ingestor_url = GEOJSON_INGESTOR
23
+
24
  # CORE PROCESSING NODES
25
  #----------------------------------------
26
  # File type detection node
app/utils.py CHANGED
@@ -9,6 +9,8 @@ from typing import Optional, Dict, Any, List
9
  # Local .env file
10
  load_dotenv()
11
 
 
 
12
  def getconfig(configfile_path: str):
13
  """
14
  Read the config file
 
9
  # Local .env file
10
  load_dotenv()
11
 
12
+ logger = logging.getLogger(__name__)
13
+
14
  def getconfig(configfile_path: str):
15
  """
16
  Read the config file
requirements.txt CHANGED
@@ -20,6 +20,7 @@ typing_extensions>=4.5.0
20
  python-multipart>=0.0.6
21
  pydantic>=2.0.0
22
  httpx>=0.24.0
 
23
 
24
 
25
 
 
20
  python-multipart>=0.0.6
21
  pydantic>=2.0.0
22
  httpx>=0.24.0
23
+ python-dotenv
24
 
25
 
26