ITSAIDI commited on
Commit
5ad177d
·
1 Parent(s): 545abd8
Files changed (1) hide show
  1. App.py +12 -7
App.py CHANGED
@@ -1,5 +1,5 @@
1
  import streamlit as st
2
- from utilitis import Draw,Add_Results
3
  from PIL import Image
4
 
5
  st.title("Bienvenue à Textra Web App")
@@ -8,12 +8,17 @@ st.write("(PNG, JPG, JPEG)")
8
  uploaded_file = st.file_uploader("Ou selectioner une image:", type=["png", "jpg", "jpeg"], accept_multiple_files=False)
9
 
10
  if uploaded_file is not None:
11
- image = Image.open(uploaded_file)
12
- image = image.convert("RGB")
13
- image,Results = Draw(image)
14
- #st.write("Predicted Text:",type(image))
 
 
 
 
 
 
 
15
  st.image(image, caption="Uploaded Image", use_column_width=True)
16
  st.sidebar.title('Results')
17
  Add_Results(Results)
18
-
19
-
 
1
  import streamlit as st
2
+ from utilitis import Draw, Add_Results
3
  from PIL import Image
4
 
5
  st.title("Bienvenue à Textra Web App")
 
8
  uploaded_file = st.file_uploader("Ou selectioner une image:", type=["png", "jpg", "jpeg"], accept_multiple_files=False)
9
 
10
  if uploaded_file is not None:
11
+ # Use Streamlit caching to avoid rerunning the processing if the same file is uploaded again
12
+ @st.cache
13
+ def process_image(uploaded_file):
14
+ image = Image.open(uploaded_file)
15
+ image = image.convert("RGB")
16
+ return Draw(image)
17
+
18
+ # Process the image and retrieve results
19
+ image, Results = process_image(uploaded_file)
20
+
21
+ # Display the processed image and results
22
  st.image(image, caption="Uploaded Image", use_column_width=True)
23
  st.sidebar.title('Results')
24
  Add_Results(Results)