ITSAIDI
commited on
Commit
·
cbaf8cc
1
Parent(s):
a469cf7
sd
Browse files
App.py
CHANGED
@@ -1,7 +1,13 @@
|
|
1 |
import streamlit as st
|
2 |
-
from utilitis import Draw,Add_Results,Change_Image
|
3 |
from PIL import Image
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
st.title("Bienvenue à Textra Web App")
|
6 |
st.markdown("### Drag and Drop votre facture ici:")
|
7 |
st.write("(PNG, JPG, JPEG)")
|
@@ -21,15 +27,37 @@ if uploaded_file is not None:
|
|
21 |
Change_Image(image,image_initiale)
|
22 |
st.sidebar.title('Results')
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
30 |
|
31 |
-
st.write("Predicted Text:",text_fourni,text_InvDate,text_InvNum,text_TT,text_TVA,text_TTC)
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from utilitis import Draw, Add_Results, Change_Image
|
3 |
from PIL import Image
|
4 |
|
5 |
+
def check_if_changed(original_values, updated_values):
|
6 |
+
for key, value in original_values.items():
|
7 |
+
if updated_values[key] != value:
|
8 |
+
return True
|
9 |
+
return False
|
10 |
+
|
11 |
st.title("Bienvenue à Textra Web App")
|
12 |
st.markdown("### Drag and Drop votre facture ici:")
|
13 |
st.write("(PNG, JPG, JPEG)")
|
|
|
27 |
Change_Image(image,image_initiale)
|
28 |
st.sidebar.title('Results')
|
29 |
|
30 |
+
# Define text inputs with initial values
|
31 |
+
text_fourni = st.sidebar.text_input("Fournisseur", value=Results["Fournisseur"])
|
32 |
+
text_InvDate = st.sidebar.text_input("Date Facture", value=Results["Date Facture"])
|
33 |
+
text_InvNum = st.sidebar.text_input("Numéro de facture", value=Results["Numéro de facture"])
|
34 |
+
text_TT = st.sidebar.text_input("Total HT", value=Results["Total HT"])
|
35 |
+
text_TVA = st.sidebar.text_input("TTC", value=Results["Total TTC"])
|
36 |
+
text_TTC = st.sidebar.text_input("TVA", value=Results["TVA"])
|
37 |
|
38 |
+
st.write("Predicted Text:", text_fourni, text_InvDate, text_InvNum, text_TT, text_TVA, text_TTC)
|
39 |
+
|
40 |
+
# Check if any input has been changed
|
41 |
+
if check_if_changed(Results, {
|
42 |
+
"Fournisseur": text_fourni,
|
43 |
+
"Date Facture": text_InvDate,
|
44 |
+
"Numéro de facture": text_InvNum,
|
45 |
+
"Total HT": text_TT,
|
46 |
+
"TVA": text_TVA,
|
47 |
+
"TTC": text_TTC
|
48 |
+
}):
|
49 |
+
# Add a button to save changes
|
50 |
+
if st.button("Sauvegarder"):
|
51 |
+
# Get updated values from text inputs
|
52 |
+
updated_results = {
|
53 |
+
"Fournisseur": text_fourni,
|
54 |
+
"Date Facture": text_InvDate,
|
55 |
+
"Numéro de facture": text_InvNum,
|
56 |
+
"Total HT": text_TT,
|
57 |
+
"TVA": text_TVA,
|
58 |
+
"TTC": text_TTC
|
59 |
+
}
|
60 |
+
|
61 |
+
# Perform action to save updated results (e.g., update database, save to file)
|
62 |
+
# Add_Results(updated_results)
|
63 |
+
st.success("Les résultats ont été sauvegardés avec succès !")
|