Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ import google.generativeai as palm
|
|
| 13 |
|
| 14 |
# load model
|
| 15 |
# PaLM API Key here
|
| 16 |
-
|
| 17 |
# Use the palm.list_models function to find available models
|
| 18 |
# PaLM 2 available in 4 sizes: Gecko, Otter, Bison and Unicorn (largest)
|
| 19 |
models = [m for m in palm.list_models() if 'generateText' in m.supported_generation_methods]
|
|
@@ -64,7 +64,7 @@ def get_completion(code_snippet):
|
|
| 64 |
```
|
| 65 |
"""
|
| 66 |
|
| 67 |
-
completion =
|
| 68 |
model=model,
|
| 69 |
prompt=prompt,
|
| 70 |
temperature=0,
|
|
@@ -77,9 +77,11 @@ def get_completion(code_snippet):
|
|
| 77 |
# define app UI
|
| 78 |
iface = gr.Interface(fn=get_completion, inputs=[gr.Textbox(label="Insert Code Snippet",lines=5)],
|
| 79 |
outputs=[gr.Textbox(label="Explanation Here",lines=8)],
|
| 80 |
-
title="
|
| 81 |
)
|
| 82 |
|
| 83 |
iface.launch()
|
| 84 |
|
| 85 |
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# load model
|
| 15 |
# PaLM API Key here
|
| 16 |
+
gemini.configure(api_key='AIzaSyArybMiPDZARDCz7yZBjzEMx6zXgOXHtoc')
|
| 17 |
# Use the palm.list_models function to find available models
|
| 18 |
# PaLM 2 available in 4 sizes: Gecko, Otter, Bison and Unicorn (largest)
|
| 19 |
models = [m for m in palm.list_models() if 'generateText' in m.supported_generation_methods]
|
|
|
|
| 64 |
```
|
| 65 |
"""
|
| 66 |
|
| 67 |
+
completion = gemini.generate_text(
|
| 68 |
model=model,
|
| 69 |
prompt=prompt,
|
| 70 |
temperature=0,
|
|
|
|
| 77 |
# define app UI
|
| 78 |
iface = gr.Interface(fn=get_completion, inputs=[gr.Textbox(label="Insert Code Snippet",lines=5)],
|
| 79 |
outputs=[gr.Textbox(label="Explanation Here",lines=8)],
|
| 80 |
+
title="Code Explainer"
|
| 81 |
)
|
| 82 |
|
| 83 |
iface.launch()
|
| 84 |
|
| 85 |
|
| 86 |
+
|
| 87 |
+
|