Spaces:
Build error
Build error
ITSAIDI
commited on
Commit
·
6a10585
1
Parent(s):
7c48137
jhjh
Browse files- App.py +4 -1
- __pycache__/utilitis.cpython-39.pyc +0 -0
- utilitis.py +7 -1
App.py
CHANGED
|
@@ -21,7 +21,10 @@ if uploaded_file is not None:
|
|
| 21 |
return Draw(image)
|
| 22 |
|
| 23 |
# Process the image and retrieve results
|
| 24 |
-
image, Results = process_image(uploaded_file)
|
|
|
|
|
|
|
|
|
|
| 25 |
Change_Image(image,image_initiale)
|
| 26 |
# Some Initializations
|
| 27 |
sauvgarder_button = st.sidebar.empty()
|
|
|
|
| 21 |
return Draw(image)
|
| 22 |
|
| 23 |
# Process the image and retrieve results
|
| 24 |
+
image, Results,execution_time = process_image(uploaded_file)
|
| 25 |
+
# Execution Time
|
| 26 |
+
st.write(f"Execution Time: {execution_time:.2f} seconds")
|
| 27 |
+
# Change Image
|
| 28 |
Change_Image(image,image_initiale)
|
| 29 |
# Some Initializations
|
| 30 |
sauvgarder_button = st.sidebar.empty()
|
__pycache__/utilitis.cpython-39.pyc
ADDED
|
Binary file (6.48 kB). View file
|
|
|
utilitis.py
CHANGED
|
@@ -4,6 +4,7 @@ from PIL import ImageDraw, ImageFont,ImageEnhance
|
|
| 4 |
import torch
|
| 5 |
from transformers import AutoProcessor,LayoutLMv3ForTokenClassification
|
| 6 |
import numpy as np
|
|
|
|
| 7 |
|
| 8 |
model_Hugging_path = "Noureddinesa/Output_LayoutLMv3_v6"
|
| 9 |
|
|
@@ -113,6 +114,8 @@ def Get_Json(true_predictions,words):
|
|
| 113 |
#############################################################################
|
| 114 |
#############################################################################
|
| 115 |
def Draw(image):
|
|
|
|
|
|
|
| 116 |
image = enhance_image(image,1.3,1.5)
|
| 117 |
true_predictions, true_boxes,words = Run_model(image)
|
| 118 |
draw = ImageDraw.Draw(image)
|
|
@@ -155,7 +158,10 @@ def Draw(image):
|
|
| 155 |
# Get the Results Json File
|
| 156 |
Results = Get_Json(true_predictions,words)
|
| 157 |
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
#############################################################################
|
| 161 |
#############################################################################
|
|
|
|
| 4 |
import torch
|
| 5 |
from transformers import AutoProcessor,LayoutLMv3ForTokenClassification
|
| 6 |
import numpy as np
|
| 7 |
+
import time
|
| 8 |
|
| 9 |
model_Hugging_path = "Noureddinesa/Output_LayoutLMv3_v6"
|
| 10 |
|
|
|
|
| 114 |
#############################################################################
|
| 115 |
#############################################################################
|
| 116 |
def Draw(image):
|
| 117 |
+
start_time = time.time()
|
| 118 |
+
|
| 119 |
image = enhance_image(image,1.3,1.5)
|
| 120 |
true_predictions, true_boxes,words = Run_model(image)
|
| 121 |
draw = ImageDraw.Draw(image)
|
|
|
|
| 158 |
# Get the Results Json File
|
| 159 |
Results = Get_Json(true_predictions,words)
|
| 160 |
|
| 161 |
+
end_time = time.time()
|
| 162 |
+
execution_time = end_time - start_time
|
| 163 |
+
|
| 164 |
+
return image,Results,execution_time
|
| 165 |
|
| 166 |
#############################################################################
|
| 167 |
#############################################################################
|