Spaces:
Running
Running
File size: 852 Bytes
d1b18b2 518c0a4 d1b18b2 bacf6db 518c0a4 d1b18b2 518c0a4 bacf6db d1b18b2 bacf6db |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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()}**")
|