Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/services/summarizer.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import os
import google.generativeai as genai
import requests
import google.auth
from google.auth.transport.requests import Request

# Replace with your actual access token
access_token = os.getenv("GCLOUD_ACCESS_TOKEN")
model_region = os.getenv("TRAINED_MODEL_LOCATION")
project_id = os.getenv("PROJECT_ID")
endpoint_id = os.getenv("ENDPOINT_ID")


credentials = google.auth.default()[0]
credentials.refresh(Request())
# print(credentials.token)
url = f"https://{model_region}-aiplatform.googleapis.com/v1/projects/{project_id}/locations/{model_region}/endpoints/{endpoint_id}:generateContent"

headers = {
"Authorization": f"Bearer {access_token}",
"Authorization": f"Bearer {credentials.token}",
"Content-Type": "application/json; charset=utf-8"
}

Expand Down