Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
import os
|
|
|
|
|
2 |
#os.system('yt-dlp --cookies-from-browser chrome')
|
3 |
from selenium import webdriver
|
4 |
from selenium.webdriver.chrome.options import Options
|
@@ -958,7 +960,7 @@ def generate_and_download_documents(summary: str):
|
|
958 |
docx_filename = f"resume_{timestamp}.docx"
|
959 |
docx_path = generate_docx(summary, docx_filename)
|
960 |
|
961 |
-
# Boutons de téléchargement
|
962 |
col1, col2 = st.columns(2)
|
963 |
with col1:
|
964 |
with open(pdf_path, "rb") as pdf_file:
|
@@ -967,7 +969,7 @@ def generate_and_download_documents(summary: str):
|
|
967 |
pdf_file,
|
968 |
file_name=pdf_filename,
|
969 |
mime="application/pdf",
|
970 |
-
key=f"download_pdf_{
|
971 |
)
|
972 |
|
973 |
with col2:
|
@@ -977,12 +979,13 @@ def generate_and_download_documents(summary: str):
|
|
977 |
docx_file,
|
978 |
file_name=docx_filename,
|
979 |
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
980 |
-
key=f"download_docx_{
|
981 |
)
|
982 |
|
983 |
return pdf_path
|
984 |
|
985 |
|
|
|
986 |
def handle_email_sending(summary: str):
|
987 |
"""Gestion de l'envoi par email"""
|
988 |
st.subheader("📧 Recevoir le résumé par email")
|
@@ -1093,7 +1096,7 @@ def display_summary_and_downloads(summary: str):
|
|
1093 |
docx_filename = f"resume_{timestamp}.docx"
|
1094 |
docx_path = generate_docx(summary, docx_filename)
|
1095 |
|
1096 |
-
# Boutons de téléchargement
|
1097 |
col1, col2 = st.columns(2)
|
1098 |
with col1:
|
1099 |
with open(pdf_path, "rb") as pdf_file:
|
@@ -1102,7 +1105,7 @@ def display_summary_and_downloads(summary: str):
|
|
1102 |
pdf_file,
|
1103 |
file_name=pdf_filename,
|
1104 |
mime="application/pdf",
|
1105 |
-
key=f"display_download_pdf_{
|
1106 |
)
|
1107 |
|
1108 |
with col2:
|
@@ -1112,7 +1115,7 @@ def display_summary_and_downloads(summary: str):
|
|
1112 |
docx_file,
|
1113 |
file_name=docx_filename,
|
1114 |
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
1115 |
-
key=f"display_download_docx_{
|
1116 |
)
|
1117 |
|
1118 |
# Option d'envoi par email
|
|
|
1 |
import os
|
2 |
+
import uuid
|
3 |
+
|
4 |
#os.system('yt-dlp --cookies-from-browser chrome')
|
5 |
from selenium import webdriver
|
6 |
from selenium.webdriver.chrome.options import Options
|
|
|
960 |
docx_filename = f"resume_{timestamp}.docx"
|
961 |
docx_path = generate_docx(summary, docx_filename)
|
962 |
|
963 |
+
# Boutons de téléchargement avec des clés uniques
|
964 |
col1, col2 = st.columns(2)
|
965 |
with col1:
|
966 |
with open(pdf_path, "rb") as pdf_file:
|
|
|
969 |
pdf_file,
|
970 |
file_name=pdf_filename,
|
971 |
mime="application/pdf",
|
972 |
+
key=f"download_pdf_{uuid.uuid4()}" # Utilisation d'un UUID
|
973 |
)
|
974 |
|
975 |
with col2:
|
|
|
979 |
docx_file,
|
980 |
file_name=docx_filename,
|
981 |
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
982 |
+
key=f"download_docx_{uuid.uuid4()}" # Utilisation d'un UUID
|
983 |
)
|
984 |
|
985 |
return pdf_path
|
986 |
|
987 |
|
988 |
+
|
989 |
def handle_email_sending(summary: str):
|
990 |
"""Gestion de l'envoi par email"""
|
991 |
st.subheader("📧 Recevoir le résumé par email")
|
|
|
1096 |
docx_filename = f"resume_{timestamp}.docx"
|
1097 |
docx_path = generate_docx(summary, docx_filename)
|
1098 |
|
1099 |
+
# Boutons de téléchargement avec des clés uniques
|
1100 |
col1, col2 = st.columns(2)
|
1101 |
with col1:
|
1102 |
with open(pdf_path, "rb") as pdf_file:
|
|
|
1105 |
pdf_file,
|
1106 |
file_name=pdf_filename,
|
1107 |
mime="application/pdf",
|
1108 |
+
key=f"display_download_pdf_{uuid.uuid4()}" # Clé unique basée sur UUID
|
1109 |
)
|
1110 |
|
1111 |
with col2:
|
|
|
1115 |
docx_file,
|
1116 |
file_name=docx_filename,
|
1117 |
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
1118 |
+
key=f"display_download_docx_{uuid.uuid4()}" # Clé unique basée sur UUID
|
1119 |
)
|
1120 |
|
1121 |
# Option d'envoi par email
|