Spaces:
Runtime error
Runtime error
File size: 1,808 Bytes
c8b1c88 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | """Streamlit UI for the Agentic Educational Content Generator."""
from __future__ import annotations
import streamlit as st
from graph import run_flow
st.set_page_config(page_title="Agentic Edu Generator", layout="centered")
st.title("Agent-Based Educational Content Generator")
st.caption("Generator Agent → Reviewer Agent → (optional one-time refinement)")
with st.form("input_form"):
grade = st.number_input("Grade", min_value=1, max_value=12, value=4, step=1)
topic = st.text_input("Topic", value="Types of angles")
submitted = st.form_submit_button("Generate Content")
if submitted:
if not str(topic).strip():
st.error("Please enter a topic.")
st.stop()
with st.spinner("Running agents..."):
state = run_flow(grade=int(grade), topic=str(topic).strip())
refinement_used = bool(state.get("refinement_used"))
st.subheader("1) Generator Output")
st.json(state.get("generator_output", {}))
st.subheader("2) Reviewer Feedback")
reviewer_output = state.get("reviewer_output", {})
st.json(reviewer_output)
feedback = reviewer_output.get("feedback") if isinstance(reviewer_output, dict) else None
if isinstance(feedback, list) and feedback:
st.markdown("**Issues found**")
for item in feedback:
st.write(f"- {item}")
if refinement_used:
st.subheader("3) Refined Output (after one refinement)")
refined = state.get("refined_generator_output")
refined_review = state.get("refined_reviewer_output")
if refined is not None:
st.markdown("**Refined Generator Output**")
st.json(refined)
if refined_review is not None:
st.markdown("**Refined Reviewer Output**")
st.json(refined_review)
st.divider()
|