init0: palm2chat
Browse files
app.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import google.generativeai as palm
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
palm.configure(api_key=os.environ.get('API_Key'))
|
| 6 |
+
|
| 7 |
+
def palm2chat(message, history):
|
| 8 |
+
response = palm.chat(messages=[message])
|
| 9 |
+
return response.last
|
| 10 |
+
|
| 11 |
+
demo = gr.ChatInterface(fn=palm2chat).queue()
|
| 12 |
+
|
| 13 |
+
demo.launch()
|