Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,25 +17,7 @@ with open('Response.json', 'r') as file:
|
|
17 |
|
18 |
st.title("MCQs Creator Application")
|
19 |
|
20 |
-
def download(df):
|
21 |
-
col1, col2 = st.columns(2)
|
22 |
|
23 |
-
if button:
|
24 |
-
if col1.button("Download CSV"):
|
25 |
-
csv_data = df.to_csv(index=False).encode("utf-8")
|
26 |
-
st.download_button(data=csv_data,
|
27 |
-
file_name="generated_mcqs.csv",
|
28 |
-
key="csv-download",
|
29 |
-
help="Click to download as CSV"
|
30 |
-
)
|
31 |
-
|
32 |
-
if col2.button("Download PDF"):
|
33 |
-
pdf_data = df.to_html().encode("utf-8")
|
34 |
-
st.download_button(data=pdf_data,
|
35 |
-
file_name="generated_mcqs.pdf",
|
36 |
-
key="pdf-download",
|
37 |
-
help="Click to download as PDF"
|
38 |
-
)
|
39 |
|
40 |
with st.form("user_inputs"):
|
41 |
uploader_file = st.file_uploader("Upload a PDF or Txt file")
|
@@ -87,6 +69,24 @@ with st.form("user_inputs"):
|
|
87 |
else:
|
88 |
st.write(response)
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
# Now you can use df outside the form if needed
|
91 |
if df is not None:
|
92 |
download(df)
|
|
|
17 |
|
18 |
st.title("MCQs Creator Application")
|
19 |
|
|
|
|
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
with st.form("user_inputs"):
|
23 |
uploader_file = st.file_uploader("Upload a PDF or Txt file")
|
|
|
69 |
else:
|
70 |
st.write(response)
|
71 |
|
72 |
+
def download(df):
|
73 |
+
col1, col2 = st.columns(2)
|
74 |
+
|
75 |
+
if button:
|
76 |
+
if col1.button("Download CSV"):
|
77 |
+
st.download_button(data=df.to_csv(index=False).encode("utf-8"),
|
78 |
+
file_name="generated_mcqs.csv",
|
79 |
+
key="csv-download",
|
80 |
+
help="Click to download as CSV"
|
81 |
+
)
|
82 |
+
|
83 |
+
if col2.button("Download PDF"):
|
84 |
+
st.download_button(data=df.to_html().encode("utf-8"),
|
85 |
+
file_name="generated_mcqs.pdf",
|
86 |
+
key="pdf-download",
|
87 |
+
help="Click to download as PDF"
|
88 |
+
)
|
89 |
+
|
90 |
# Now you can use df outside the form if needed
|
91 |
if df is not None:
|
92 |
download(df)
|