bstraehle commited on
Commit
1311489
·
1 Parent(s): e3184f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
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
- #completion = generation_model.generate_content(prompt).text
45
- #wandb.log({"prompt": prompt, "completion": completion})
46
- #return completion
47
- return "Execution is commented out, to view the source code see https://huggingface.co/spaces/bstraehle/google-vertex-ai-llm/tree/main."
 
 
 
 
 
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>."""