import streamlit as st import google.generativeai as palm # Information about obtaining a free API key st.sidebar.info("Get your free palm2 API key at [makersuite.google.com/app/apikey](https://makersuite.google.com/app/apikey)") # Ask the user for palm2 API key if not provided 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() # Configure the API key palm.configure(api_key=api_key) # Styling for the title st.title("Auto Study Notes Generator") st.markdown("---") # Sidebar for settings 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("---") # Main content area st.header(f"Study Notes Generation for {user_class}") user_input = st.text_input('Enter your study topic:') st.markdown("---") # Generate button 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 # Display the generated study notes st.subheader(f"Study Notes for {user_class} - {user_input}:") st.write(study_notes) # Add a footer with updated text st.sidebar.markdown("---") st.sidebar.text("© 2023 HelpingAI") # Hide Streamlit menu st.markdown(""" """, unsafe_allow_html=True)