LuisBlanche commited on
Commit
6e6cb08
1 Parent(s): b6a9bcf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -307,10 +307,15 @@ def generate_poster(deputy_name, message_1, message_2, vote_list):
307
  pdfposter.retrieve_deputy_data()
308
  pdf_buffer = pdfposter.generate_poster(vote_list, message_1, message_2)
309
 
 
310
  # Generate a preview image of the first page
 
 
 
311
  pdf_buffer.seek(0)
312
  preview_image = create_pdf_preview(pdf_buffer)
313
- return preview_image, pdf_path
 
314
 
315
 
316
  with gr.Blocks(css=css) as demo:
 
307
  pdfposter.retrieve_deputy_data()
308
  pdf_buffer = pdfposter.generate_poster(vote_list, message_1, message_2)
309
 
310
+ filename = f"/data/{deputy_name}_votes.pdf"
311
  # Generate a preview image of the first page
312
+ with open(filename, "wb") as f:
313
+ f.write(pdf_buffer.read())
314
+
315
  pdf_buffer.seek(0)
316
  preview_image = create_pdf_preview(pdf_buffer)
317
+
318
+ return preview_image, filename
319
 
320
 
321
  with gr.Blocks(css=css) as demo: