Spaces:
Sleeping
Sleeping
app.py
Browse files
app.py
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
+
import streamlit as st
|
4 |
+
|
5 |
+
# Get API key from environment variable
|
6 |
+
api_key = os.environ.get("API_KEY")
|
7 |
+
if api_key is None:
|
8 |
+
raise ValueError("API_KEY environment variable not set")
|
9 |
+
|
10 |
+
# Set API key for OpenAI
|
11 |
+
openai.api_key = api_key
|
12 |
+
|
13 |
+
def write_sidebar():
|
14 |
+
st.sidebar.title("Instructions")
|
15 |
+
st.sidebar.write("1. Select the student's grade level.")
|
16 |
+
st.sidebar.write("2. Select the student's qualifying condition(s).")
|
17 |
+
st.sidebar.write("3. Choose a prompt based to communicate with the AI how you want your data analyzed.")
|
18 |
+
st.sidebar.write("4. Enter your student data.")
|
19 |
+
st.sidebar.write("5. Click the 'Analyze Student Data' button to generate a summary of your data.")
|
20 |
+
|
21 |
+
st.sidebar.write("")
|
22 |
+
st.sidebar.write("")
|
23 |
+
|
24 |
+
st.sidebar.write("Note: This app uses OpenAI's GPT-3 API to generate the PLAAFP statement. Please enter data that is relevant and appropriate for generating the statement.")
|
25 |
+
|
26 |
+
def write_iep_assist():
|
27 |
+
st.title("IEP Assist Premium")
|
28 |
+
|
29 |
+
# Select the student's grade level
|
30 |
+
st.write("Select the student's grade level:")
|
31 |
+
grade_level = st.selectbox("Grade:", ["Pre-K", "K", "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th"], key="grade-level")
|
32 |
+
|
33 |
+
# Select the student's qualifying condition
|
34 |
+
st.write("Select the student's qualifying condition(s):")
|
35 |
+
qualifying_condition = st.multiselect("Qualifying Condition(s):", ["Specific Learning Disability", "Emotional Disturbance", "Autism", "Intellectual Disability", "Speech/Language Impairment", "Other Health Impairment", "Orthopedic Impairment", "Auditory Impairment", "Traumatic Brain Injury", "Deafness", "Blindness", "Developmental Delay"], key="qualifying-condition")
|
36 |
+
|
37 |
+
# Choose a prompt
|
38 |
+
st.write("Choose a prompt:(This tells the AI how you want your data analyzed)")
|
39 |
+
prompts = [
|
40 |
+
"Analyze the data provided on the student and provide a summary of their strengths and areas of need in regards to their academic performance.",
|
41 |
+
"Provide a summary of the student's behavior data and suggest possible interventions to try based on their areas of need.",
|
42 |
+
"Summarize the data provided on the student's academic performance, highlighting their strengths and areas of need, and suggesting possible interventions to try.",
|
43 |
+
"Please provide a summary of the student's academic performance, highlighting their strengths and areas of need.",
|
44 |
+
"What is the student's biggest strength and area of need in regards to their academic performance?",
|
45 |
+
"Analyze the data provided on the student and provide a summary of their progress in regards to their IEP goals.",
|
46 |
+
"Based on the student's academic performance data, what recommendations do you have for adjusting their instructional strategies?",
|
47 |
+
"How can the student's strengths be leveraged to help them improve in areas of need?",
|
48 |
+
"What barriers to academic success does the student face, and how can they be addressed?",
|
49 |
+
"Analyze the student's behavior data to identify trends and suggest possible interventions.",
|
50 |
+
"Provide a summary of the student's progress towards their academic and behavioral goals."
|
51 |
+
]
|
52 |
+
selected_prompt = st.selectbox("Prompt:", options=prompts, key="prompt")
|
53 |
+
|
54 |
+
st.write("Enter student data to be analyzed:")
|
55 |
+
student_data = st.text_area("Paste student data here", height=250, key="student-data")
|
56 |
+
|
57 |
+
# Add a button to generate the PLAAFP statement
|
58 |
+
if st.button("Analyze Student Data", key="analyze-button"):
|
59 |
+
# Call the OpenAI API and generate a response
|
60 |
+
response = openai.Completion.create(
|
61 |
+
engine="text-davinci-003",
|
62 |
+
prompt=f"{selected_prompt} {student_data} {grade_level} {qualifying_condition}",
|
63 |
+
max_tokens=2000,
|
64 |
+
n=1,
|
65 |
+
stop=None,
|
66 |
+
temperature=0.9,
|
67 |
+
)
|
68 |
+
|
69 |
+
# Extract the generated statement from the API response
|
70 |
+
statement = response["choices"][0]["text"]
|
71 |
+
|
72 |
+
# Show the generated statement
|
73 |
+
st.write("Summary of Data entered:", statement)
|
74 |
+
|
75 |
+
def write_iep_goal_generator():
|
76 |
+
st.title("IEP Goal Compass")
|
77 |
+
|
78 |
+
grade_level = st.selectbox("Select the student's grade level:", ["Pre-K", "K", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], key="grade_level")
|
79 |
+
qualifying_condition = st.multiselect("Select the qualifying condition(s):", ["Autism", "Emotional disturbance", "Intellectual disability", "Specific learning disability", "Other health impairment", "Speech or language impairment", "Deaf-blindness", "Deafness", "Blindness", "Multiple disabilities", "Orthopedic impairment", "Traumatic brain injury"], key="qualifying_condition")
|
80 |
+
teacher_input = st.text_area("Enter student data:", key="teacher_input")
|
81 |
+
|
82 |
+
# Generate IEP goal
|
83 |
+
if st.button("Generate Goal", key="generate_goal"):
|
84 |
+
# Call the OpenAI API and generate a goal
|
85 |
+
response = openai.Completion.create(
|
86 |
+
engine="text-davinci-003",
|
87 |
+
prompt=f"Generate an achievable and measurableable IEP goal for a student who is in grade {grade_level} and has qualifying conditions of {', '.join(qualifying_condition)} based on teacher reported information: {teacher_input}",
|
88 |
+
max_tokens=2000,
|
89 |
+
n=1,
|
90 |
+
stop=None,
|
91 |
+
temperature=0.85,
|
92 |
+
)
|
93 |
+
goal = response["choices"][0]["text"]
|
94 |
+
# Show the generated goal
|
95 |
+
st.write("IEP Goal:", goal)
|
96 |
+
|
97 |
+
if __name__ == "__main__":
|
98 |
+
write_sidebar()
|
99 |
+
write_iep_assist()
|
100 |
+
write_iep_goal_generator()
|