File size: 382 Bytes
71ad11e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import google.generativeai as palm
import streamlit as st 

# Set your API key
palm.configure(api_key='PALM_KEY')

# Select the PaLM 2 model
model = 'models/text-bison-001'

# Generate text
prompt = "Write a poem about a cat."
completion = palm.generate_text(model=model, prompt=prompt, temperature=0.5, max_output_tokens=800)

# Print the generated text
st.write(completion.result)