Update app.py
Browse files
app.py
CHANGED
@@ -26,20 +26,20 @@ if credentials.expired:
|
|
26 |
|
27 |
vertexai.init(project = project,
|
28 |
location = "us-central1",
|
29 |
-
credentials =
|
30 |
)
|
31 |
|
32 |
from vertexai.language_models import TextGenerationModel
|
33 |
generation_model = TextGenerationModel.from_pretrained(config.model)
|
34 |
|
35 |
def invoke(prompt):
|
36 |
-
completion = generation_model.predict(prompt = prompt).text
|
37 |
-
wandb.log({"prompt": prompt, "completion": completion})
|
38 |
-
return completion
|
|
|
39 |
|
40 |
description = """<a href='https://www.gradio.app/'>Gradio</a> UI using <a href='https://cloud.google.com/vertex-ai?hl=en/'>Google Vertex AI</a> API
|
41 |
-
with Bison foundation model. Model performance evaluation via <a href='https://wandb.ai/bstraehle'>Weights & Biases</a>.
|
42 |
-
Note: Credentials are commented out in this HF space, you will get an error but can view the code."""
|
43 |
|
44 |
gr.close_all()
|
45 |
demo = gr.Interface(fn=invoke,
|
|
|
26 |
|
27 |
vertexai.init(project = project,
|
28 |
location = "us-central1",
|
29 |
+
credentials = credentials
|
30 |
)
|
31 |
|
32 |
from vertexai.language_models import TextGenerationModel
|
33 |
generation_model = TextGenerationModel.from_pretrained(config.model)
|
34 |
|
35 |
def invoke(prompt):
|
36 |
+
#completion = generation_model.predict(prompt = prompt).text
|
37 |
+
#wandb.log({"prompt": prompt, "completion": completion})
|
38 |
+
#return completion
|
39 |
+
return "Execution is commented out in this HF space, but can view the code at ..."
|
40 |
|
41 |
description = """<a href='https://www.gradio.app/'>Gradio</a> UI using <a href='https://cloud.google.com/vertex-ai?hl=en/'>Google Vertex AI</a> API
|
42 |
+
with Bison foundation model. Model performance evaluation via <a href='https://wandb.ai/bstraehle'>Weights & Biases</a>."""
|
|
|
43 |
|
44 |
gr.close_all()
|
45 |
demo = gr.Interface(fn=invoke,
|