File size: 1,165 Bytes
e2bb6f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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)