File size: 821 Bytes
d005d10
 
1c0e770
d005d10
 
 
 
 
adefb9c
d005d10
adefb9c
d005d10
 
 
 
 
 
 
 
2066091
d005d10
 
adefb9c
d005d10
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import google.generativeai as genai
import gradio as gr
import os

genai.configure(api_key=os.getenv("GOOGLE_PALM_KEY"))

def generate(prompt, history, system):
  response = genai.chat(
    context=system,
    messages=prompt)
    
  return response.last

additional = [
    gr.Textbox(label="System Prompt", max_lines=1, info="English only", value="You are PaLM-2 (AI-assistant from Google)"),
]

gr.ChatInterface(
    fn=generate,
    chatbot=gr.Chatbot(show_label=False, avatar_images=(None, 'palm-logo.png'), show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
    additional_inputs=additional,
    title="PaLM-2",
    description="This is unofficial demo of PaLM-2 based on Google API. History/context memory does not work in this demo."
    concurrency_limit=20,
).launch(show_api=False)