Spaces:
Runtime error
Runtime error
Christian Koch
commited on
Commit
·
fe38db6
1
Parent(s):
4333e67
add temperature and count slider
Browse files
app.py
CHANGED
|
@@ -11,6 +11,23 @@ st.title('Question Generator by Eddevs')
|
|
| 11 |
|
| 12 |
select = st.selectbox('Type', ['Question Generator', 'Paraphrasing', 'Summarization', 'Fill in the blank'])
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
if select == "Summarization":
|
| 15 |
with st.form("summarization"):
|
| 16 |
# left_column, right_column = st.columns(2)
|
|
@@ -28,7 +45,7 @@ if select == "Summarization":
|
|
| 28 |
|
| 29 |
|
| 30 |
if select == "Fill in the blank":
|
| 31 |
-
with st.form("
|
| 32 |
text_input = st.text_area("Input Text")
|
| 33 |
|
| 34 |
submitted = st.form_submit_button("Generate")
|
|
@@ -44,14 +61,16 @@ if select == "Fill in the blank":
|
|
| 44 |
if select == "Paraphrasing":
|
| 45 |
with st.form("paraphrasing"):
|
| 46 |
# st.selectbox('Model', ['T5', 'GPT Neo-X'])
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
text_input = st.text_area("Input Text")
|
| 49 |
|
| 50 |
submitted = st.form_submit_button("Generate")
|
| 51 |
|
| 52 |
if submitted:
|
| 53 |
with st.spinner('Wait for it...'):
|
| 54 |
-
paraphrase_model = PegasusParaphraser()
|
| 55 |
result = paraphrase_model.paraphrase(text_input)
|
| 56 |
st.write(result)
|
| 57 |
|
|
|
|
| 11 |
|
| 12 |
select = st.selectbox('Type', ['Question Generator', 'Paraphrasing', 'Summarization', 'Fill in the blank'])
|
| 13 |
|
| 14 |
+
|
| 15 |
+
if select == "Question Generator":
|
| 16 |
+
with st.form("question_gen"):
|
| 17 |
+
# left_column, right_column = st.columns(2)
|
| 18 |
+
# left_column.selectbox('Type', ['Question Generator', 'Paraphrasing'])
|
| 19 |
+
#st.selectbox('Model', ['T5', 'GPT Neo-X'])
|
| 20 |
+
|
| 21 |
+
text_input = st.text_area("Input Text")
|
| 22 |
+
|
| 23 |
+
submitted = st.form_submit_button("Generate")
|
| 24 |
+
|
| 25 |
+
if submitted:
|
| 26 |
+
with st.spinner('Wait for it...'):
|
| 27 |
+
result = FillInSummary().summarize(text_input)
|
| 28 |
+
st.write(text_input)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
if select == "Summarization":
|
| 32 |
with st.form("summarization"):
|
| 33 |
# left_column, right_column = st.columns(2)
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
if select == "Fill in the blank":
|
| 48 |
+
with st.form("fill_in_the_blank"):
|
| 49 |
text_input = st.text_area("Input Text")
|
| 50 |
|
| 51 |
submitted = st.form_submit_button("Generate")
|
|
|
|
| 61 |
if select == "Paraphrasing":
|
| 62 |
with st.form("paraphrasing"):
|
| 63 |
# st.selectbox('Model', ['T5', 'GPT Neo-X'])
|
| 64 |
+
left_column, right_column = st.columns(2)
|
| 65 |
+
count = left_column.slider('Count', 0, 10, 3)
|
| 66 |
+
temperature = right_column.slider('Temperature', 0.0, 10.0, 1.5)
|
| 67 |
text_input = st.text_area("Input Text")
|
| 68 |
|
| 69 |
submitted = st.form_submit_button("Generate")
|
| 70 |
|
| 71 |
if submitted:
|
| 72 |
with st.spinner('Wait for it...'):
|
| 73 |
+
paraphrase_model = PegasusParaphraser(num_return_sequences=count,temperature=temperature)
|
| 74 |
result = paraphrase_model.paraphrase(text_input)
|
| 75 |
st.write(result)
|
| 76 |
|