Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,23 +79,30 @@ Include:
|
|
| 79 |
template="""
|
| 80 |
You are a Virginia Geometry Standards of Learning (SOL) assistant.
|
| 81 |
|
| 82 |
-
|
| 83 |
{context}
|
| 84 |
|
| 85 |
-
|
| 86 |
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
"""
|
| 89 |
)
|
| 90 |
|
| 91 |
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
def generate_output(prompt_type, query):
|
| 95 |
docs = retriever.get_relevant_documents(query)
|
| 96 |
context = "\n\n".join([doc.page_content for doc in docs])
|
| 97 |
chain = LLMChain(llm=llm, prompt=templates[prompt_type])
|
| 98 |
-
|
|
|
|
|
|
|
| 99 |
|
| 100 |
# ✅ Gradio UI
|
| 101 |
with gr.Blocks() as demo:
|
|
|
|
| 79 |
template="""
|
| 80 |
You are a Virginia Geometry Standards of Learning (SOL) assistant.
|
| 81 |
|
| 82 |
+
From the following standards content:
|
| 83 |
{context}
|
| 84 |
|
| 85 |
+
Identify the SOL standard (e.g., G.RLT.1, G.TR.3) that most accurately answers the user's question: "{query}"
|
| 86 |
|
| 87 |
+
Respond with:
|
| 88 |
+
1. The SOL code (e.g., G.RLT.3)
|
| 89 |
+
2. The **exact standard description** for that code, as written in the context
|
| 90 |
+
|
| 91 |
+
Do not summarize. Copy the official description exactly.
|
| 92 |
"""
|
| 93 |
)
|
| 94 |
|
| 95 |
|
| 96 |
+
|
| 97 |
}
|
| 98 |
|
| 99 |
def generate_output(prompt_type, query):
|
| 100 |
docs = retriever.get_relevant_documents(query)
|
| 101 |
context = "\n\n".join([doc.page_content for doc in docs])
|
| 102 |
chain = LLMChain(llm=llm, prompt=templates[prompt_type])
|
| 103 |
+
output = chain.run({"context": context, "query": query})
|
| 104 |
+
return output.strip()
|
| 105 |
+
|
| 106 |
|
| 107 |
# ✅ Gradio UI
|
| 108 |
with gr.Blocks() as demo:
|