Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import json, os, vertexai, wandb
|
|
4 |
from dotenv import load_dotenv, find_dotenv
|
5 |
_ = load_dotenv(find_dotenv())
|
6 |
|
7 |
-
|
8 |
project = os.environ["PROJECT"]
|
9 |
wandb_api_key = os.environ["WANDB_API_KEY"]
|
10 |
|
@@ -16,23 +16,24 @@ wandb.login(key = wandb_api_key)
|
|
16 |
wandb.init(project = "vertext-ai-txt", config = config)
|
17 |
config = wandb.config
|
18 |
|
19 |
-
|
20 |
|
21 |
from google.oauth2 import service_account
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
from vertexai.language_models import TextGenerationModel
|
32 |
generation_model = TextGenerationModel.from_pretrained("text-bison@001")
|
33 |
|
34 |
def invoke(prompt, credentials):
|
35 |
//
|
|
|
36 |
credentials = service_account.Credentials.from_service_account_info(credentials)
|
37 |
if credentials.expired:
|
38 |
credentials.refresh(Request())
|
|
|
4 |
from dotenv import load_dotenv, find_dotenv
|
5 |
_ = load_dotenv(find_dotenv())
|
6 |
|
7 |
+
#credentials = os.environ["CREDENTIALS"]
|
8 |
project = os.environ["PROJECT"]
|
9 |
wandb_api_key = os.environ["WANDB_API_KEY"]
|
10 |
|
|
|
16 |
wandb.init(project = "vertext-ai-txt", config = config)
|
17 |
config = wandb.config
|
18 |
|
19 |
+
#credentials = json.loads(credentials)
|
20 |
|
21 |
from google.oauth2 import service_account
|
22 |
+
#credentials = service_account.Credentials.from_service_account_info(credentials)
|
23 |
|
24 |
+
#if credentials.expired:
|
25 |
+
# credentials.refresh(Request())
|
26 |
|
27 |
+
#vertexai.init(project = project,
|
28 |
+
# location = "us-central1",
|
29 |
+
# credentials = credentials)
|
30 |
|
31 |
from vertexai.language_models import TextGenerationModel
|
32 |
generation_model = TextGenerationModel.from_pretrained("text-bison@001")
|
33 |
|
34 |
def invoke(prompt, credentials):
|
35 |
//
|
36 |
+
credentials = json.loads(credentials)
|
37 |
credentials = service_account.Credentials.from_service_account_info(credentials)
|
38 |
if credentials.expired:
|
39 |
credentials.refresh(Request())
|