Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +49 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import google.generativeai as genai
|
| 3 |
+
import os
|
| 4 |
+
from dotenv import load_dotenv
|
| 5 |
+
|
| 6 |
+
load_dotenv() ## load all our environment variables
|
| 7 |
+
|
| 8 |
+
os.getenv("GOOGLE_API_KEY")
|
| 9 |
+
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def get_gemini_response(input):
|
| 14 |
+
model=genai.GenerativeModel('gemini-pro')
|
| 15 |
+
response=model.generate_content(input)
|
| 16 |
+
return response.text
|
| 17 |
+
|
| 18 |
+
## streamlit app
|
| 19 |
+
# Set page title and description
|
| 20 |
+
st.set_page_config(page_title="AI Lesson Plan Generator for ICSE by Jishnu Setia", page_icon=":books:")
|
| 21 |
+
st.title("AI Lesson Plan Generator for ICSE by Jishnu Setia")
|
| 22 |
+
st.write("Create interactive lesson plans for your students")
|
| 23 |
+
st.write("Note: Their may be hallucinations in some instances")
|
| 24 |
+
|
| 25 |
+
# Input fields
|
| 26 |
+
with st.form("Lesson Plan Form"):
|
| 27 |
+
st.header("Lesson Plan Details")
|
| 28 |
+
topic = st.text_input("Topic Name")
|
| 29 |
+
grade = st.text_input("Grade")
|
| 30 |
+
submit_button = st.form_submit_button("Generate Lesson Plan")
|
| 31 |
+
|
| 32 |
+
# Generate and display lesson plan
|
| 33 |
+
if submit_button:
|
| 34 |
+
input_prompt = f"""
|
| 35 |
+
You're an ICSE (Indian Certificate of Secondary Education) teacher preparing a lesson plan tailored to the specific needs of your students.
|
| 36 |
+
Take into consideration the grade level {grade} and the topic to cover in your lesson. Topic is {topic}. Your task is to create a detailed lesson plan focusing on the chosen topic, ensuring it aligns with the curriculum standards for that grade level.
|
| 37 |
+
Include engaging activities, clear explanations, and relevant visual aids to enhance understanding and retention among your students.
|
| 38 |
+
Give your response based on the topic in this structure:
|
| 39 |
+
Topic Name:
|
| 40 |
+
Learning Intention
|
| 41 |
+
Learning Objective:
|
| 42 |
+
Success Criteria:
|
| 43 |
+
Points which will be covered in class: (Elaborate on each point)
|
| 44 |
+
Questions for a small quiz:
|
| 45 |
+
Ways to make the class interactive:
|
| 46 |
+
"""
|
| 47 |
+
response = get_gemini_response(input_prompt.format(grade=grade, topic=topic))
|
| 48 |
+
st.header("Generated Lesson Plan")
|
| 49 |
+
st.subheader(response)
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
google.generativeai
|
| 3 |
+
python-dotenv
|