Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ from google.oauth2 import service_account
|
|
11 |
|
12 |
credentials = json.loads(credentials)
|
13 |
credentials = service_account.Credentials.from_service_account_info(credentials)
|
14 |
-
print("###"
|
15 |
|
16 |
#if credentials.expired:
|
17 |
# credentials.refresh(Request())
|
@@ -19,10 +19,12 @@ print("###"+credentials)
|
|
19 |
vertexai.init(project = project,
|
20 |
location = "us-west1",
|
21 |
credentials = credentials)
|
|
|
22 |
|
23 |
from vertexai.language_models import TextGenerationModel
|
24 |
|
25 |
generation_model = TextGenerationModel.from_pretrained("text-bison@001")
|
|
|
26 |
|
27 |
def invoke(prompt):
|
28 |
return generation_model.predict(prompt = prompt).text
|
|
|
11 |
|
12 |
credentials = json.loads(credentials)
|
13 |
credentials = service_account.Credentials.from_service_account_info(credentials)
|
14 |
+
print("###1")
|
15 |
|
16 |
#if credentials.expired:
|
17 |
# credentials.refresh(Request())
|
|
|
19 |
vertexai.init(project = project,
|
20 |
location = "us-west1",
|
21 |
credentials = credentials)
|
22 |
+
print("###2")
|
23 |
|
24 |
from vertexai.language_models import TextGenerationModel
|
25 |
|
26 |
generation_model = TextGenerationModel.from_pretrained("text-bison@001")
|
27 |
+
print("###3")
|
28 |
|
29 |
def invoke(prompt):
|
30 |
return generation_model.predict(prompt = prompt).text
|