def db_setup()

in UI/evaluation/eval.py [0:0]


def db_setup(project_id, dataset_id, metadata_path, method):
    """ """
    token = "Bearer "
    body = {
        "proj_name": project_id,
        "bq_dataset": dataset_id,
    }
    headers = {"Content-type": "application/json",
               "Authorization": token}
    if method == FEW_SHOT_GENERATION:
        url = os.getenv(GEN_BY_LITE)
    else:
        url = os.getenv(GEN_BY_CORE)

    if metadata_path:
        with open(metadata_path, "r") as f:
            string_data = f.read()
        files = {"file": (metadata_path.split("/")[-1], string_data)}
        body["metadata_file"] = metadata_path.split("/")[-1]

    _ = requests.post(
            url=url+"/projconfig",
            data=json.dumps(body),
            headers=headers,
            timeout=None)

    if metadata_path:
        _ = requests.post(
                url=url+"/uploadfile",
                headers={"Authorization": token},
                files=files,
                timeout=None
            )