Spaces:
Sleeping
Sleeping
Configure Vertex service account JSON bootstrap
#1
by archivartaunik - opened
Files changed (2)
12345678910111213141516171819202122232425262728293031323334353637383940414243"""Gradio UI wired to hexagonal architecture services."""from __future__ import annotations
import jsonimport osimport tempfilefrom dotenv import load_dotenv
load_dotenv()
# ---------------------------------------------------------------------------# Google Service Account credentials bootstrap for Vertex AI.## In Hugging Face Spaces, store the full service-account key JSON in the# secret GOOGLE_SERVICE_ACCOUNT_JSON. This writes it to a temporary file and# exposes GOOGLE_APPLICATION_CREDENTIALS so google-genai / Vertex clients can# use Application Default Credentials.# ---------------------------------------------------------------------------if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"): sa_json = os.environ.get("GOOGLE_SERVICE_ACCOUNT_JSON", "").strip() if sa_json: try: json.loads(sa_json) tmp = tempfile.NamedTemporaryFile( mode="w", suffix=".json", delete=False, prefix="gcp_sa_", encoding="utf-8", ) tmp.write(sa_json) tmp.close() os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = tmp.name print(f"DEBUG: Wrote service-account credentials to {tmp.name}") except (json.JSONDecodeError, OSError) as exc: print(f"WARNING: GOOGLE_SERVICE_ACCOUNT_JSON is set but invalid: {exc}")
print(f"DEBUG: CWD is {os.getcwd()}")print(f"DEBUG: SUPABASE_URL present: {bool(os.environ.get('SUPABASE_URL'))}")print(f"DEBUG: GOOGLE_APPLICATION_CREDENTIALS: {os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', '(not set)')}")
from calls_analyser.ui import config as ui_configfrom calls_analyser.ui.dependencies import build_dependencies2 unmodified lines345678910111213142 unmodified linesnumpy>=1.26.4soundfile>=0.12.1google-genai>=0.6.0google-cloud-storage>=2.14.0gradiopydantic>=2.7.0pytest>=8.2.0APSchedulerpython-dotenv>=1.0.0supabasegit+https://github.com/tuteishygpt/CallsAnaliser.git@main#app.py+30
requirements.txt+2