tharun1507 commited on
Commit
91641ff
·
verified ·
1 Parent(s): b7c3dfb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -6,14 +6,15 @@
6
 
7
  #@title DECIPHER THE CODE EXPLAINER
8
  import gradio as gr
9
- import google.generativeai as genai
10
 
11
  # load model
12
  # PaLM API Key here
13
- genai.configure(api_key='AIzaSyArybMiPDZARDCz7yZBjzEMx6zXgOXHtoc')
14
  # Use the palm.list_models function to find available models
15
  # PaLM 2 available in 4 sizes: Gecko, Otter, Bison and Unicorn (largest)
16
- models =genai.GenerativeModel(gemini-1.0-pro)
 
17
  # define completion function
18
  def get_completion(code_snippet):
19
 
@@ -60,7 +61,7 @@ def get_completion(code_snippet):
60
  ```
61
  """
62
 
63
- completion = genai.generate_text(
64
  model=model,
65
  prompt=prompt,
66
  temperature=0,
 
6
 
7
  #@title DECIPHER THE CODE EXPLAINER
8
  import gradio as gr
9
+ import google.generativeai as palm
10
 
11
  # load model
12
  # PaLM API Key here
13
+ palm.configure(api_key='AIzaSyArybMiPDZARDCz7yZBjzEMx6zXgOXHtoc')
14
  # Use the palm.list_models function to find available models
15
  # PaLM 2 available in 4 sizes: Gecko, Otter, Bison and Unicorn (largest)
16
+ models = [m for m in palm.list_models() if 'generateText' in m.supported_generation_methods]
17
+ model = models[0].name
18
  # define completion function
19
  def get_completion(code_snippet):
20
 
 
61
  ```
62
  """
63
 
64
+ completion = palm.generate_text(
65
  model=model,
66
  prompt=prompt,
67
  temperature=0,