ProfessorLeVesseur
commited on
Commit
•
6ea871f
1
Parent(s):
ad18331
Update app.py
Browse files
app.py
CHANGED
@@ -533,7 +533,7 @@ def download_llm_output(content, filename):
|
|
533 |
buffer.write(content.encode('utf-8'))
|
534 |
buffer.seek(0)
|
535 |
# Add a download button to Streamlit
|
536 |
-
st.download_button(label="Download
|
537 |
|
538 |
def prepare_llm_input(student_metrics_df):
|
539 |
# Convert the student metrics DataFrame to a string
|
@@ -551,11 +551,34 @@ Provide:
|
|
551 |
"""
|
552 |
return llm_input
|
553 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
def prompt_response_from_hf_llm(llm_input):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
# Generate the refined prompt using Hugging Face API
|
556 |
response = client.chat.completions.create(
|
557 |
model="meta-llama/Llama-3.1-70B-Instruct",
|
558 |
messages=[
|
|
|
559 |
{"role": "user", "content": llm_input}
|
560 |
],
|
561 |
stream=True,
|
|
|
533 |
buffer.write(content.encode('utf-8'))
|
534 |
buffer.seek(0)
|
535 |
# Add a download button to Streamlit
|
536 |
+
st.download_button(label="Download AI Output", data=buffer, file_name=filename, mime='text/plain', icon="✏️", use_container_width=True)
|
537 |
|
538 |
def prepare_llm_input(student_metrics_df):
|
539 |
# Convert the student metrics DataFrame to a string
|
|
|
551 |
"""
|
552 |
return llm_input
|
553 |
|
554 |
+
|
555 |
+
# def prompt_response_from_hf_llm(llm_input):
|
556 |
+
# # Generate the refined prompt using Hugging Face API
|
557 |
+
# response = client.chat.completions.create(
|
558 |
+
# model="meta-llama/Llama-3.1-70B-Instruct",
|
559 |
+
# messages=[
|
560 |
+
# {"role": "user", "content": llm_input}
|
561 |
+
# ],
|
562 |
+
# stream=True,
|
563 |
+
# temperature=0.5,
|
564 |
+
# max_tokens=1024,
|
565 |
+
# top_p=0.7
|
566 |
+
# )
|
567 |
+
|
568 |
def prompt_response_from_hf_llm(llm_input):
|
569 |
+
# Define a system prompt to guide the model's responses
|
570 |
+
system_prompt = """
|
571 |
+
<Persona> An expert Implementation Specialist at Michigan's Multi-Tiered System of Support Technical Assistance Center (MiMTSS TA Center) with deep expertise in SWPBIS, SEL, Structured Literacy, Science of Reading, and family engagement practices.</Persona>
|
572 |
+
<Task> Analyze educational data and provide evidence-based recommendations for improving student outcomes across multiple tiers of support, drawing from established frameworks in behavioral interventions, literacy instruction, and family engagement.</Task>
|
573 |
+
<Context> Operating within Michigan's educational system to support schools in implementing multi-tiered support systems, with access to student metrics data and knowledge of state-specific educational requirements and MTSS frameworks. </Context>
|
574 |
+
<Format> Deliver insights through clear, actionable recommendations supported by data analysis, incorporating technical expertise while maintaining accessibility for educators and administrators at various levels of MTSS implementation.</Format>
|
575 |
+
"""
|
576 |
+
|
577 |
# Generate the refined prompt using Hugging Face API
|
578 |
response = client.chat.completions.create(
|
579 |
model="meta-llama/Llama-3.1-70B-Instruct",
|
580 |
messages=[
|
581 |
+
{"role": "system", "content": system_prompt}, # Add system prompt here
|
582 |
{"role": "user", "content": llm_input}
|
583 |
],
|
584 |
stream=True,
|