File size: 1,062 Bytes
f48bfec
93f6c86
f48bfec
 
 
 
 
 
 
 
 
93f6c86
 
 
 
 
 
 
 
 
 
 
ed124a5
f48bfec
 
 
93f6c86
f48bfec
 
 
 
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
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[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