Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
st.title('Question Generator by Eddevs') | |
left_column, right_column = st.columns(2) | |
left_column.selectbox('Type', ['Question Generator', 'Paraphrasing']) | |
right_column.selectbox('Question Generator', ['T5', 'GPT Neo-X']) | |
input = st.text_area("Input Text") | |
def summarize(text): | |
# Refer to https://huggingface.co/docs/transformers/v4.18.0/en/main_classes/pipelines#transformers.SummarizationPipeline | |
# for further information about configuration. | |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
# Refer to https://huggingface.co/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig | |
# for further configuration of of the | |
output: list = summarizer( | |
text, | |
max_length=130, | |
min_length=30, | |
do_sample=False) | |
return output | |
#return output[0]['summary_text'] | |
if st.button('Generate'): | |
# st.write(input) | |
st.write(summarize(input)) | |
st.success("We have generated 105 Questions for you") | |
st.snow() | |
##else: | |
##nothing here | |