Update app.py
Browse files
app.py
CHANGED
@@ -41,10 +41,15 @@ generation_model = GenerativeModel(config.model)
|
|
41 |
|
42 |
def invoke(prompt):
|
43 |
#completion = generation_model.predict(prompt = prompt).text
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
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
|
50 |
with gemini-pro foundation model. Model performance evaluation via <a href='https://wandb.ai/bstraehle'>Weights & Biases</a>."""
|
|
|
41 |
|
42 |
def invoke(prompt):
|
43 |
#completion = generation_model.predict(prompt = prompt).text
|
44 |
+
completion = generation_model.generate_content(prompt, generation_config = {
|
45 |
+
"max_output_tokens": config.max_output_tokens,
|
46 |
+
"temperature": config.temperature,
|
47 |
+
"top_k": config.top_k,
|
48 |
+
"top_p": config.top_p,
|
49 |
+
}).text
|
50 |
+
wandb.log({"prompt": prompt, "completion": completion})
|
51 |
+
return completion
|
52 |
+
#return "Execution is commented out, to view the source code see https://huggingface.co/spaces/bstraehle/google-vertex-ai-llm/tree/main."
|
53 |
|
54 |
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
|
55 |
with gemini-pro foundation model. Model performance evaluation via <a href='https://wandb.ai/bstraehle'>Weights & Biases</a>."""
|