Update app.py
Browse files
app.py
CHANGED
@@ -296,12 +296,14 @@ def generate_poster(deputy_name, message_1, message_2, vote_list):
|
|
296 |
pdfposter.retrieve_deputy_data()
|
297 |
pdf_filename = pdfposter.generate_poster(vote_list, message_1, message_2)
|
298 |
|
299 |
-
#
|
300 |
-
|
301 |
-
os.
|
|
|
|
|
302 |
|
303 |
# Create the iframe HTML to display the PDF
|
304 |
-
iframe_html = f'<iframe src="/file={
|
305 |
return gr.HTML(iframe_html)
|
306 |
|
307 |
with gr.Blocks(css=css) as demo:
|
@@ -319,9 +321,9 @@ with gr.Blocks(css=css) as demo:
|
|
319 |
placeholder="Nom du député, si tu ne le connais pas RDV sur www.datan.fr ou www.nosdeputes.fr",
|
320 |
container=False,
|
321 |
)
|
322 |
-
fetch_button = gr.Button("
|
323 |
|
324 |
-
vote_list = gr.CheckboxGroup(label="
|
325 |
|
326 |
with gr.Row():
|
327 |
message_1 = gr.Text(
|
|
|
296 |
pdfposter.retrieve_deputy_data()
|
297 |
pdf_filename = pdfposter.generate_poster(vote_list, message_1, message_2)
|
298 |
|
299 |
+
# Move the PDF to a known location
|
300 |
+
static_dir = './static/'
|
301 |
+
os.makedirs(static_dir, exist_ok=True)
|
302 |
+
static_pdf_path = os.path.join(static_dir, pdf_filename)
|
303 |
+
os.rename(pdf_filename, static_pdf_path)
|
304 |
|
305 |
# Create the iframe HTML to display the PDF
|
306 |
+
iframe_html = f'<iframe src="/file={static_pdf_path}" width="100%" height="600px"></iframe>'
|
307 |
return gr.HTML(iframe_html)
|
308 |
|
309 |
with gr.Blocks(css=css) as demo:
|
|
|
321 |
placeholder="Nom du député, si tu ne le connais pas RDV sur www.datan.fr ou www.nosdeputes.fr",
|
322 |
container=False,
|
323 |
)
|
324 |
+
fetch_button = gr.Button("Récupère ses votes importants", scale=0)
|
325 |
|
326 |
+
vote_list = gr.CheckboxGroup(label="Choisis les votes que tu souhaites afficher", choices=[])
|
327 |
|
328 |
with gr.Row():
|
329 |
message_1 = gr.Text(
|