Spaces:
Sleeping
Sleeping
File size: 1,027 Bytes
e8d0bda 2701c34 a61f3e4 e8d0bda c286457 e8d0bda a61f3e4 e8d0bda e41619c 779f0a5 589481f e8d0bda 94ca5cb a61f3e4 589481f 0e911e1 e8d0bda fca4e51 a61f3e4 8ba8d8a a61f3e4 589481f 8ba8d8a 779f0a5 |
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 |
import streamlit as st
import nltk
from transformers import pipeline
# Initialize NLTK
nltk.download('punkt')
# Instantiate the model
model = pipeline(model="dantedgp/question-generator", tokenizer="google-t5/t5-small")
placeholder = """The mitochondria is the powerhouse of the cell.
Glycolisis harnesses the energy in the bonds of glucose.
The nucleus stores the genetic code of a living being.
The peroxisome produces hydrogen peroxide used for lipid breakdown.
Ribosomes are the sites of protein synthesis.
Antibodies label and target pathogens for destruction.
Hemoglobin is a transport protein for oxygen."""
st.set_page_config(page_title='AI Quiz Generator')
st.title('AI Quiz Generator')
text_input = st.text_area('Enter your text', value=placeholder, height=200)
generate_button = st.button("Generate")
if generate_button:
sentences = nltk.sent_tokenize(text_input)
print(sentences)
for sentence in sentences:
output = model(f"ask: {sentence}")[0]['generated_text']
st.write(output)
|