Spaces:
Sleeping
Sleeping
LaurentTRIPIED
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,13 @@
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import PyPDF2
|
3 |
import json
|
4 |
|
|
|
|
|
|
|
5 |
# Fonction pour extraire le texte du PDF
|
6 |
def extract_text_from_pdf(pdf_path):
|
7 |
text = []
|
@@ -25,6 +31,9 @@ def display_json_contents(file_path):
|
|
25 |
except FileNotFoundError:
|
26 |
st.error(f"Le fichier {file_path} n'a pas été trouvé.")
|
27 |
|
|
|
|
|
|
|
28 |
# Interface Streamlit
|
29 |
st.title("Extracteur de Texte PDF et Sauvegarde en JSON")
|
30 |
|
@@ -52,4 +61,4 @@ try:
|
|
52 |
mime="application/json"
|
53 |
)
|
54 |
except FileNotFoundError:
|
55 |
-
st.error(f"Le fichier {json_output_path} n'est pas disponible pour téléchargement.")
|
|
|
1 |
+
###################################################
|
2 |
+
# Import des bibliothèques
|
3 |
+
###################################################
|
4 |
import streamlit as st
|
5 |
import PyPDF2
|
6 |
import json
|
7 |
|
8 |
+
###################################################
|
9 |
+
# LES FONCTIONS DE CONVERSION PDF -> TEXTE -> JSON
|
10 |
+
###################################################
|
11 |
# Fonction pour extraire le texte du PDF
|
12 |
def extract_text_from_pdf(pdf_path):
|
13 |
text = []
|
|
|
31 |
except FileNotFoundError:
|
32 |
st.error(f"Le fichier {file_path} n'a pas été trouvé.")
|
33 |
|
34 |
+
###################################################
|
35 |
+
# INTERFACE
|
36 |
+
###################################################
|
37 |
# Interface Streamlit
|
38 |
st.title("Extracteur de Texte PDF et Sauvegarde en JSON")
|
39 |
|
|
|
61 |
mime="application/json"
|
62 |
)
|
63 |
except FileNotFoundError:
|
64 |
+
st.error(f"Le fichier {json_output_path} n'est pas disponible pour téléchargement.")
|