Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import streamlit as st
|
|
| 2 |
from transformers import pipeline
|
| 3 |
from PyPDF2 import PdfReader
|
| 4 |
import nltk
|
| 5 |
-
|
| 6 |
nltk.download('punkt')
|
| 7 |
st.title(body='7 - Question Generation')
|
| 8 |
|
|
@@ -37,16 +37,23 @@ if st.toggle(label='Show Proposition 1'):
|
|
| 37 |
x = i['generated_text'][10:]
|
| 38 |
questions.append(x)
|
| 39 |
# st.write(f':blue[{x}]')
|
| 40 |
-
|
| 41 |
-
if st.toggle(label='Show Questions'):
|
| 42 |
-
st.subheader("*Generated Questions are:*")
|
| 43 |
-
for i in s:
|
| 44 |
-
x = i['generated_text'][10:]
|
| 45 |
-
questions.append(x)
|
| 46 |
-
st.write(f':blue[{x}]')
|
| 47 |
if st.toggle('Show Text'):
|
| 48 |
st.write(raw_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
if st.toggle(label='Show Pipeline Output'):
|
| 50 |
st.write(s)
|
| 51 |
if st.toggle(label='Show Questions list'):
|
| 52 |
st.write(questions)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
from PyPDF2 import PdfReader
|
| 4 |
import nltk
|
| 5 |
+
import pandas as pd
|
| 6 |
nltk.download('punkt')
|
| 7 |
st.title(body='7 - Question Generation')
|
| 8 |
|
|
|
|
| 37 |
x = i['generated_text'][10:]
|
| 38 |
questions.append(x)
|
| 39 |
# st.write(f':blue[{x}]')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
if st.toggle('Show Text'):
|
| 41 |
st.write(raw_text)
|
| 42 |
+
if st.toggle(label='Show Questions'):
|
| 43 |
+
st.subheader("*Generated Questions are:*")
|
| 44 |
+
for i in questions:
|
| 45 |
+
st.write(f':blue[{i}]')
|
| 46 |
if st.toggle(label='Show Pipeline Output'):
|
| 47 |
st.write(s)
|
| 48 |
if st.toggle(label='Show Questions list'):
|
| 49 |
st.write(questions)
|
| 50 |
+
|
| 51 |
+
if questions:
|
| 52 |
+
df = pd.DataFrame(questions, columns=["Question"])
|
| 53 |
+
csv = df.to_csv(index=False).encode('utf-8')
|
| 54 |
+
st.download_button(
|
| 55 |
+
label="Download Questions as CSV",
|
| 56 |
+
data=csv,
|
| 57 |
+
file_name='questions.csv',
|
| 58 |
+
mime='text/csv'
|
| 59 |
+
)
|