bstraehle commited on
Commit
cc1ba93
·
1 Parent(s): 139db9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -10,8 +10,8 @@ wandb_api_key = os.environ["WANDB_API_KEY"]
10
 
11
  config = {
12
  "max_output_tokens": 800,
13
- "model": "text-bison@001",
14
- #"model": "gemini-pro",
15
  "temperature": 0,
16
  "top_k": 250,
17
  "top_p": 0.999,
@@ -34,14 +34,14 @@ vertexai.init(project = project,
34
  credentials = credentials
35
  )
36
 
37
- from vertexai.language_models import TextGenerationModel
38
- generation_model = TextGenerationModel.from_pretrained(config.model)
39
- #from vertexai.preview.generative_models import GenerativeModel
40
- #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, but you can view the code at https://huggingface.co/spaces/bstraehle/google-vertex-ai-llm/tree/main."
 
10
 
11
  config = {
12
  "max_output_tokens": 800,
13
+ #"model": "text-bison@001",
14
+ "model": "gemini-pro",
15
  "temperature": 0,
16
  "top_k": 250,
17
  "top_p": 0.999,
 
34
  credentials = credentials
35
  )
36
 
37
+ #from vertexai.language_models import TextGenerationModel
38
+ #generation_model = TextGenerationModel.from_pretrained(config.model)
39
+ from vertexai.preview.generative_models import GenerativeModel
40
+ 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, but you can view the code at https://huggingface.co/spaces/bstraehle/google-vertex-ai-llm/tree/main."