import streamlit as st import openai openai.api_key = "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" st.title("A.I, Lesson Plan Generator by Amaan") age = st.number_input("Enter learner's age",min_value=6,max_value=80,step=1) subject = st.text_area("Enter the subject") topic = st.text_area("Enter the topic of your Subject") complexity_levels = ["Beginner",'Intermediate','Advanced','Expert','Master'] complexity = st.selectbox("Select the complexity", complexity_levels) duration = ['1 hour','1 week','1 month','6 month'] plan_duration = st.selectbox("Choose your duration", duration) if st.button("Generate lesson plan"): prompt = f"You are tasked to produce an detailed lesson plan for teaching {subject} on the topic {topic} and to age {age} year old student, The lesson plan should be designed for {plan_duration}" response = openai.Completion.create( engine = "text-davinci-003", prompt = prompt, max_tokens = 1500, temperature = 0.7, n = 1, stop = None ) lesson_plan = response.choices[0].text.strip() st.subheader("Generated lesson plan: ") st.write(lesson_plan)