Spaces:
Sleeping
Sleeping
import google.generativeai as genai | |
import streamlit as st | |
import os | |
st.set_page_config(layout="wide") | |
st.markdown(""" | |
<style> | |
#MainMenu {visibility: hidden;} | |
footer {visibility: hidden;} | |
header {visibility: hidden;} | |
</style> | |
""", unsafe_allow_html=True) | |
# Set your API key | |
genai.configure(api_key = os.environ['PALM_KEY']) | |
# Select the PaLM 2 model | |
# model = 'models/text-bison-001' | |
model = genai.GenerativeModel('gemini-pro') | |
# Generate text | |
if prompt := st.chat_input("Ask your query..."): | |
enprom = f"""Answer the below provided input in context to Bhagwad Geeta. Use the verses and chapters sentences as references to your answer with suggestions | |
coming from Bhagwad Geeta. Your answer to below input should only be in context to Bhagwad geeta only.\nInput= {prompt}""" | |
completion = model.generate_content(enprom) | |
# response = palm.chat(messages=["Hello."]) | |
# print(response.last) # 'Hello! What can I help you with?' | |
# response.reply("Can you tell me a joke?") | |
# Print the generated text | |
with st.chat_message("Assistant"): | |
st.write(completion.text) | |