Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,8 +11,7 @@ from langchain_openai import ChatOpenAI
|
|
11 |
from langchain.prompts import PromptTemplate
|
12 |
from langchain.chains import LLMChain
|
13 |
from langchain.chains import SequentialChain
|
14 |
-
import
|
15 |
-
import wkhtmltopdf
|
16 |
|
17 |
with open('Response.json', 'r') as file:
|
18 |
RESPONSE_JSON = json.load(file)
|
@@ -74,6 +73,7 @@ with st.form("user_inputs"):
|
|
74 |
def download(df):
|
75 |
col1, col2 = st.columns(2)
|
76 |
html_content=df.to_html(index=False)
|
|
|
77 |
|
78 |
if button:
|
79 |
col1.download_button(label="Download CSV",
|
@@ -83,8 +83,10 @@ def download(df):
|
|
83 |
help="Click to download as CSV"
|
84 |
)
|
85 |
|
86 |
-
|
87 |
-
|
|
|
|
|
88 |
|
89 |
|
90 |
|
|
|
11 |
from langchain.prompts import PromptTemplate
|
12 |
from langchain.chains import LLMChain
|
13 |
from langchain.chains import SequentialChain
|
14 |
+
from weasyprint import HTML
|
|
|
15 |
|
16 |
with open('Response.json', 'r') as file:
|
17 |
RESPONSE_JSON = json.load(file)
|
|
|
73 |
def download(df):
|
74 |
col1, col2 = st.columns(2)
|
75 |
html_content=df.to_html(index=False)
|
76 |
+
pdf_path= "generated_mcqs.pdf"
|
77 |
|
78 |
if button:
|
79 |
col1.download_button(label="Download CSV",
|
|
|
83 |
help="Click to download as CSV"
|
84 |
)
|
85 |
|
86 |
+
col2.download_button(label="Download PDF",
|
87 |
+
data= HTML(string=html_content).write_pdf(pdf_path),
|
88 |
+
key="pdf-download",
|
89 |
+
help="Click to download as PDF")
|
90 |
|
91 |
|
92 |
|