Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -110,16 +110,19 @@ convo = model.start_chat(history=[
|
|
110 |
},
|
111 |
])
|
112 |
|
113 |
-
|
|
|
|
|
114 |
|
115 |
def generate(messages):
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
120 |
|
121 |
gr.ChatInterface(
|
122 |
-
fn=generate
|
123 |
chatbot=gr.Chatbot(show_label=False, avatar_images=(None, 'palm-logo.png'), show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
124 |
title="PaLM-2",
|
125 |
description="This is unofficial demo of ```PaLM-2``` based on ```Google API```. ```History/context``` memory does not work in this demo.",
|
|
|
110 |
},
|
111 |
])
|
112 |
|
113 |
+
#response = convo.send_message(
|
114 |
+
# messages=messages)
|
115 |
+
# return response.last.text
|
116 |
|
117 |
def generate(messages):
|
118 |
+
model = genai.GenerativeModel('gemini-pro')
|
119 |
+
response = model.generate_content(
|
120 |
+
messages,
|
121 |
+
stream=True,
|
122 |
+
generation_config=generation_config)
|
123 |
|
124 |
gr.ChatInterface(
|
125 |
+
fn=generate,
|
126 |
chatbot=gr.Chatbot(show_label=False, avatar_images=(None, 'palm-logo.png'), show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
127 |
title="PaLM-2",
|
128 |
description="This is unofficial demo of ```PaLM-2``` based on ```Google API```. ```History/context``` memory does not work in this demo.",
|