Manikandan-Alagu commited on
Commit
981230c
·
verified ·
1 Parent(s): 1824a6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -65,22 +65,15 @@ with st.form("user_inputs"):
65
 
66
  st.text_area(label="Review",value=response["review"])
67
 
 
68
  csv_filename = "generated_mcqs.csv"
69
- st.download_button(
70
- label="Download as CSV",
71
- data=df.to_csv(index=False).encode("utf-8"),
72
- file_name=csv_filename,
73
- key="csv-download",
74
- )
75
-
76
- # Download Button for PDF
77
  pdf_filename = "generated_mcqs.pdf"
78
- st.download_button(
79
- label="Download as PDF",
80
- data=df.to_html().encode("utf-8"),
81
- file_name=pdf_filename,
82
- key="pdf-download",
83
- )
84
  else:
85
  st.error("Error in the table date")
86
 
 
65
 
66
  st.text_area(label="Review",value=response["review"])
67
 
68
+ # Download Buttons for CSV and PDF
69
  csv_filename = "generated_mcqs.csv"
70
+ csv_link = f'<a href="data:file/csv;base64,{df.to_csv(index=False).encode("utf-8").decode()}" download="{csv_filename}">Download as CSV</a>'
71
+ st.markdown(csv_link, unsafe_allow_html=True)
72
+
 
 
 
 
 
73
  pdf_filename = "generated_mcqs.pdf"
74
+ pdf_link = f'<a href="data:application/pdf;base64,{df.to_html().encode("utf-8").decode()}" download="{pdf_filename}">Download as PDF</a>'
75
+ st.markdown(pdf_link, unsafe_allow_html=True)
76
+
 
 
 
77
  else:
78
  st.error("Error in the table date")
79