Spaces:
Runtime error
Runtime error
Christian Koch
commited on
Commit
•
0177922
1
Parent(s):
e00aee9
fill in the gap, summarization
Browse files- app.py +59 -24
- requirements.txt +4 -2
app.py
CHANGED
@@ -1,32 +1,67 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
st.title('Question Generator by Eddevs')
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
# st.write(input)
|
28 |
-
st.
|
29 |
-
st.success("We have generated 105 Questions for you")
|
30 |
# st.snow()
|
31 |
##else:
|
32 |
##nothing here
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline, PegasusForConditionalGeneration, PegasusTokenizer
|
3 |
+
from fill_in_summary import FillInSummary
|
4 |
+
|
5 |
+
def paraphrase(text):
|
6 |
+
return text
|
7 |
+
|
8 |
|
9 |
st.title('Question Generator by Eddevs')
|
10 |
|
11 |
+
select = st.selectbox('Type', ['Question Generator', 'Paraphrasing', 'Summarization', 'Fill in the gap'])
|
12 |
+
|
13 |
+
if select == "Summarization":
|
14 |
+
with st.form("summarization"):
|
15 |
+
# left_column, right_column = st.columns(2)
|
16 |
+
# left_column.selectbox('Type', ['Question Generator', 'Paraphrasing'])
|
17 |
+
st.selectbox('Model', ['T5', 'GPT Neo-X'])
|
18 |
+
|
19 |
+
input = st.text_area("Input Text")
|
20 |
+
|
21 |
+
submitted = st.form_submit_button("Generate")
|
22 |
+
|
23 |
+
if submitted:
|
24 |
+
st.write(FillInSummary().summarize(input))
|
25 |
+
|
26 |
+
|
27 |
+
if select == "Fill in the gap":
|
28 |
+
with st.form("summarization"):
|
29 |
+
# left_column, right_column = st.columns(2)
|
30 |
+
# left_column.selectbox('Type', ['Question Generator', 'Paraphrasing'])
|
31 |
+
st.selectbox('Model', ['T5', 'GPT Neo-X'])
|
32 |
+
|
33 |
+
input = st.text_area("Input Text")
|
34 |
+
|
35 |
+
submitted = st.form_submit_button("Generate")
|
36 |
+
|
37 |
+
if submitted:
|
38 |
+
fill = FillInSummary()
|
39 |
+
summarized = fill.summarize(input)
|
40 |
+
st.write(fill.blank_ne_out(summarized))
|
41 |
+
|
42 |
+
|
43 |
+
if select == "Paraphrasing":
|
44 |
+
with st.form("paraphrasing"):
|
45 |
+
# left_column, right_column = st.columns(2)
|
46 |
+
# left_column.selectbox('Type', ['Question Generator', 'Paraphrasing'])
|
47 |
+
st.selectbox('Model', ['T5', 'GPT Neo-X'])
|
48 |
+
|
49 |
+
input = st.text_area("Input Text")
|
50 |
+
|
51 |
+
submitted = st.form_submit_button("Generate")
|
52 |
+
|
53 |
+
if submitted:
|
54 |
+
st.write(paraphrase(input))
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
#if st.button('Generate'):
|
61 |
# st.write(input)
|
62 |
+
#st.success("We have generated 105 Questions for you")
|
|
|
63 |
# st.snow()
|
64 |
##else:
|
65 |
##nothing here
|
66 |
+
|
67 |
+
|
requirements.txt
CHANGED
@@ -1,3 +1,5 @@
|
|
1 |
-
transformers
|
2 |
torch
|
3 |
-
tensorflow
|
|
|
|
|
|
1 |
+
transformers~=4.18.0
|
2 |
torch
|
3 |
+
tensorflow
|
4 |
+
streamlit~=1.8.1
|
5 |
+
sentencepiece==0.1.96
|