CoolFace
Apppublic

diegokauer/segmentation-backend

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
0likes
creds.py16 linesDownload Raw Back to root
1import json2import tempfile3import os4 5# process of getting credentials6def get_credentials():7    creds_json_str = os.getenv("creds") # get json credentials stored as a string8    if creds_json_str is None:9        raise ValueError("GOOGLE_APPLICATION_CREDENTIALS_JSON not found in environment")10 11    # create a temporary file12    with tempfile.NamedTemporaryFile(mode="w+", delete=False, suffix=".json") as temp:13        temp.write(creds_json_str) # write in json format14        temp_filename = temp.name 15 16    return temp_filename