|
import streamlit as st |
|
import google.generativeai as palm |
|
|
|
|
|
st.sidebar.info("Get your free palm2 API key at [makersuite.google.com/app/apikey](https://makersuite.google.com/app/apikey)") |
|
|
|
|
|
api_key = st.sidebar.text_input("Enter your palm2 API key:", type="password") |
|
if not api_key: |
|
st.warning("Please enter your palm2 API key.") |
|
st.stop() |
|
|
|
|
|
palm.configure(api_key=api_key) |
|
|
|
|
|
st.title("Auto Study Notes Generator") |
|
st.markdown("---") |
|
|
|
|
|
st.sidebar.title("Settings") |
|
user_class = st.sidebar.selectbox('Select your class:', ['Class 1', 'Class 2', 'Class 3', 'Class 4', 'Class 5', 'Class 6', |
|
'Class 7', 'Class 8', 'Class 9', 'Class 10', 'Class 11', 'Class 12']) |
|
st.sidebar.markdown("---") |
|
|
|
|
|
st.header(f"Study Notes Generation for {user_class}") |
|
user_input = st.text_input('Enter your study topic:') |
|
st.markdown("---") |
|
|
|
|
|
if st.button('Generate Study Notes'): |
|
if user_input.lower() in ['quit', 'exit', 'bye']: |
|
st.success("Goodbye! Have a great day!") |
|
else: |
|
with st.spinner("Generating study notes. Please wait..."): |
|
st.subheader(f"Making notes for you on '{user_input}'") |
|
prompt = f"Provide study notes for {user_class} on the topic: {user_input}." |
|
response = palm.generate_text(model='models/text-bison-001', prompt=prompt) |
|
study_notes = response.result |
|
|
|
|
|
st.subheader(f"Study Notes for {user_class} - {user_input}:") |
|
st.write(study_notes) |
|
|
|
|
|
st.sidebar.markdown("---") |
|
st.sidebar.text("© 2023 HelpingAI") |
|
|
|
|
|
st.markdown(""" |
|
<style> |
|
#MainMenu {visibility: hidden;} |
|
</style> |
|
""", unsafe_allow_html=True) |
|
|