Drop files here
or click to upload
import streamlit as st
from preprocess import clean_text, lemmatize
from embedder import get_embedding
from scorer import compute_similarity, calculate_score
from feedback import generate_feedback
from models.model_answer_store import extract_tagged_concepts, concept_score
st.set_page_config(page_title="Automated Theoretical Answer Evaluation System")
st.title("Automated Theoretical Answer Evaluation System")
with st.form("evaluation_form"):
st.write("Paste the *model answer* (with <primary>, <secondary>, <tertiary> tags):")
model_ans = st.text_area("Model Answer", height=140)
st.write("Paste the *student answer*:")
student_ans = st.text_area("Student Answer", height=140)
submitted = st.form_submit_button("Evaluate")
if submitted:
# Preprocess
clean_student = lemmatize(clean_text(student_ans))
clean_model = lemmatize(clean_text(model_ans))
# Embeddings
try:
vec_model = get_embedding(clean_model)
vec_student = get_embedding(clean_student)
semantic_sim = compute_similarity(vec_model, vec_student)
except Exception as e:
st.error(f"Embedding Error: {e}")
st.stop()
# Concept Coverage
concepts = extract_tagged_concepts(model_ans)
concept_cov = concept_score(clean_student, concepts)
# Placeholder for structure score
struct_score = 0.7
final_score = calculate_score(semantic_sim, concept_cov, struct_score)
feedback = generate_feedback(final_score, semantic_sim)
st.subheader("Results")
st.markdown(f"**Final Score:** {final_score} / 10")
st.markdown(f"**Semantic Similarity:** {semantic_sim:.4f}")
st.markdown(f"**Concept Coverage:** {concept_cov:.2f}")
st.info(feedback)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?