File size: 1,589 Bytes
901dbf6
60c1b07
901dbf6
51113c2
901dbf6
60c1b07
cbaf8cc
60c1b07
73bc32e
 
901dbf6
73bc32e
901dbf6
 
ab1449b
 
6288d29
 
 
 
 
ab1449b
6288d29
6a10585
 
 
 
ab1449b
60c1b07
 
 
fdd783a
60c1b07
 
745dfe3
 
60c1b07
 
51113c2
 
 
60c1b07
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import streamlit as st
from utilitis import Draw,Change_Image,check_if_changed,Update
from PIL import Image
import time 

    

st.set_page_config(layout='wide')
st.title("Bienvenue à Textra Web App")
st.markdown("### Drag and Drop votre facture ici:")
st.write("(PNG, JPG, JPEG)")
uploaded_file = st.file_uploader("Ou selectioner une image:", type=["png", "jpg", "jpeg"], accept_multiple_files=False)

if uploaded_file is not None:
    image_initiale = Image.open(uploaded_file)
    image_initiale = image_initiale.convert("RGB")
    @st.cache_data
    def process_image(uploaded_file):
        image = Image.open(uploaded_file)
        image = image.convert("RGB")
        return Draw(image)
    
    # Process the image and retrieve results
    image, Results,execution_time = process_image(uploaded_file)
    # Execution Time
    st.write(f"Execution Time: {execution_time:.2f} seconds")
    # Change Image
    Change_Image(image,image_initiale)
    # Some Initializations
    sauvgarder_button = st.sidebar.empty()
    success_message = st.sidebar.empty()
    st.sidebar.title('Results')
    # Get Track of User Modeifications :
    New_results = Update(Results)
    # Check if any input has been changed
    if check_if_changed(Results,New_results):
        st.write(check_if_changed(Results,New_results))        
        if sauvgarder_button.button("Sauvegarder"):
            success_message.success("Les résultats ont été sauvegardés avec succès !")
            time.sleep(1)
            success_message.empty()
            st.write(New_results)