Spaces:
Running
Running
import streamlit as st | |
from transformers import pipeline | |
# Load the question generation model | |
qg_pipeline = pipeline("text2text-generation", model="iarfmoose/t5-base-question-generator") | |
st.title("AI-Powered Quiz Generator") | |
text = st.text_area("Enter a paragraph to generate quiz questions:") | |
if st.button("Generate Questions"): | |
if text.strip() == "": | |
st.warning("Please enter some text to generate questions.") | |
else: | |
with st.spinner("Generating questions..."): | |
result = qg_pipeline(f"generate questions: {text}", max_length=512, do_sample=True, temperature=0.7) | |
questions = result[0]['generated_text'].split("\n") | |
st.subheader("Generated Questions:") | |
for i, q in enumerate(questions): | |
if q.strip(): | |
st.markdown(f"**Q{i+1}: {q.strip()}**") | |