Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +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 |
|
15 |
with open('Response.json', 'r') as file:
|
16 |
RESPONSE_JSON = json.load(file)
|
@@ -71,6 +72,7 @@ with st.form("user_inputs"):
|
|
71 |
|
72 |
def download(df):
|
73 |
col1, col2 = st.columns(2)
|
|
|
74 |
|
75 |
if button:
|
76 |
col1.download_button(label="Download CSV",
|
@@ -78,9 +80,11 @@ def download(df):
|
|
78 |
file_name="generated_mcqs.csv",
|
79 |
key="csv-download",
|
80 |
help="Click to download as CSV"
|
81 |
-
)
|
|
|
|
|
82 |
col2.download_button(label="Download PDF",
|
83 |
-
data=
|
84 |
file_name="generated_mcqs.pdf",
|
85 |
key="pdf-download",
|
86 |
help="Click to download as PDF"
|
|
|
11 |
from langchain.prompts import PromptTemplate
|
12 |
from langchain.chains import LLMChain
|
13 |
from langchain.chains import SequentialChain
|
14 |
+
import pdfkit as pdf
|
15 |
|
16 |
with open('Response.json', 'r') as file:
|
17 |
RESPONSE_JSON = json.load(file)
|
|
|
72 |
|
73 |
def download(df):
|
74 |
col1, col2 = st.columns(2)
|
75 |
+
df.to_html('mcq.html').encode("utf-8")
|
76 |
|
77 |
if button:
|
78 |
col1.download_button(label="Download CSV",
|
|
|
80 |
file_name="generated_mcqs.csv",
|
81 |
key="csv-download",
|
82 |
help="Click to download as CSV"
|
83 |
+
)
|
84 |
+
|
85 |
+
|
86 |
col2.download_button(label="Download PDF",
|
87 |
+
data=pdf.from_file('mcq.html'),
|
88 |
file_name="generated_mcqs.pdf",
|
89 |
key="pdf-download",
|
90 |
help="Click to download as PDF"
|