Manikandan-Alagu commited on
Commit
9534df5
·
verified ·
1 Parent(s): 02a52e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -15
app.py CHANGED
@@ -18,24 +18,29 @@ with open('Response.json', 'r') as file:
18
  st.title("MCQs Creator Application")
19
 
20
  def download(df):
21
- csv_filename = "generated_mcqs.csv"
22
- pdf_filename = "generated_mcqs.pdf"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
 
25
-
26
- if button:
27
- st.download_button(label="Download as CSV",
28
- data=df.to_csv(index=False).encode("utf-8"),
29
- file_name=csv_filename,
30
- key="csv-download",
31
- use_container_width=True
32
- )
33
 
34
- st.download_button(label="Download as PDF",
35
- data=df.to_html().encode("utf-8"),
36
- file_name=pdf_filename,
37
- key="pdf-download",
38
- use_container_width=True)
39
 
40
 
41
  with st.form("user_inputs"):
 
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 as 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
+
41
 
42
 
 
 
 
 
 
 
 
 
43
 
 
 
 
 
 
44
 
45
 
46
  with st.form("user_inputs"):