Spaces:
Runtime error
Runtime error
Commit
·
ab01f25
1
Parent(s):
d433231
Update app.py
Browse files
app.py
CHANGED
@@ -76,10 +76,12 @@ def process_text(inputs):
|
|
76 |
# st.markdown(href, unsafe_allow_html=True)
|
77 |
|
78 |
|
|
|
|
|
79 |
def save_as_pdf(text):
|
80 |
# convert quill editor HTML to PDF
|
81 |
pdf_file = BytesIO()
|
82 |
-
HTML(string=text).write_pdf(pdf_file)
|
83 |
|
84 |
# encode the PDF to base64
|
85 |
b64 = base64.b64encode(pdf_file.getvalue()).decode('utf-8')
|
@@ -179,8 +181,9 @@ def form_page():
|
|
179 |
|
180 |
#from quill.delta import Delta, Renderer
|
181 |
|
|
|
|
|
182 |
def editor_page():
|
183 |
-
#st.markdown("### Editor :smile:")
|
184 |
st.markdown("<h1 style='text-align: center; color: Red;'>Editor</h1>", unsafe_allow_html=True)
|
185 |
|
186 |
st.write("Use the editor below to edit the obituary:")
|
@@ -188,8 +191,7 @@ def editor_page():
|
|
188 |
quill_text = st.session_state.output_text
|
189 |
edited_text = st_quill(quill_text)
|
190 |
|
191 |
-
st.
|
192 |
-
#st.write(edited_text)
|
193 |
|
194 |
st.session_state.edited_text = edited_text
|
195 |
|
|
|
76 |
# st.markdown(href, unsafe_allow_html=True)
|
77 |
|
78 |
|
79 |
+
import weasyprint
|
80 |
+
|
81 |
def save_as_pdf(text):
|
82 |
# convert quill editor HTML to PDF
|
83 |
pdf_file = BytesIO()
|
84 |
+
weasyprint.HTML(string=text).write_pdf(pdf_file)
|
85 |
|
86 |
# encode the PDF to base64
|
87 |
b64 = base64.b64encode(pdf_file.getvalue()).decode('utf-8')
|
|
|
181 |
|
182 |
#from quill.delta import Delta, Renderer
|
183 |
|
184 |
+
|
185 |
+
|
186 |
def editor_page():
|
|
|
187 |
st.markdown("<h1 style='text-align: center; color: Red;'>Editor</h1>", unsafe_allow_html=True)
|
188 |
|
189 |
st.write("Use the editor below to edit the obituary:")
|
|
|
191 |
quill_text = st.session_state.output_text
|
192 |
edited_text = st_quill(quill_text)
|
193 |
|
194 |
+
st.markdown(edited_text, unsafe_allow_html=True)
|
|
|
195 |
|
196 |
st.session_state.edited_text = edited_text
|
197 |
|