Spaces:
Running
Running
final commit
Browse files
.gitignore
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
.env
|
| 2 |
-
dependencies/
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
.env
|
| 2 |
+
dependencies/
|
| 3 |
+
__pycache__/
|
| 4 |
+
sample.py
|
| 5 |
+
multiple_request.py
|
__pycache__/app.cpython-312.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ
|
|
|
layoutlmv3FineTuning/Layoutlm_inference/__pycache__/inference_handler.cpython-312.pyc
CHANGED
|
Binary files a/layoutlmv3FineTuning/Layoutlm_inference/__pycache__/inference_handler.cpython-312.pyc and b/layoutlmv3FineTuning/Layoutlm_inference/__pycache__/inference_handler.cpython-312.pyc differ
|
|
|
layoutlmv3FineTuning/Layoutlm_inference/inference_handler.py
CHANGED
|
@@ -219,24 +219,28 @@ class ModelHandler(object):
|
|
| 219 |
IFSC = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'IFSC')
|
| 220 |
|
| 221 |
print("entered cheque\n\n",flattened_output_list,"\n\n")
|
| 222 |
-
result = {"
|
| 223 |
-
"
|
|
|
|
| 224 |
if self.name == "aadhar":
|
| 225 |
aadhar_num = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'AN')
|
| 226 |
print("entered aadhar\n\n",flattened_output_list,"\n\n")
|
| 227 |
# IFSC = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'IFSC')
|
| 228 |
-
result = {"
|
|
|
|
| 229 |
|
| 230 |
if self.name == "pan":
|
| 231 |
pan_num = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'PAN_VALUE')
|
| 232 |
print("entered pan\n\n",flattened_output_list,"\n\n")
|
| 233 |
# IFSC = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'IFSC')
|
| 234 |
-
result = {"
|
|
|
|
| 235 |
if self.name == "gst":
|
| 236 |
gstin_num = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'GSTIN')
|
| 237 |
print("entered gst\n\n",flattened_output_list,"\n\n")
|
| 238 |
# IFSC = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'IFSC')
|
| 239 |
-
result = {"
|
|
|
|
| 240 |
|
| 241 |
|
| 242 |
# if
|
|
|
|
| 219 |
IFSC = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'IFSC')
|
| 220 |
|
| 221 |
print("entered cheque\n\n",flattened_output_list,"\n\n")
|
| 222 |
+
result = {"attachment_num":acc_num,
|
| 223 |
+
"attachment_ifsc":IFSC,
|
| 224 |
+
"attachment_status":200}
|
| 225 |
if self.name == "aadhar":
|
| 226 |
aadhar_num = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'AN')
|
| 227 |
print("entered aadhar\n\n",flattened_output_list,"\n\n")
|
| 228 |
# IFSC = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'IFSC')
|
| 229 |
+
result = {"attachment_num":aadhar_num,
|
| 230 |
+
"attachment_status":200}
|
| 231 |
|
| 232 |
if self.name == "pan":
|
| 233 |
pan_num = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'PAN_VALUE')
|
| 234 |
print("entered pan\n\n",flattened_output_list,"\n\n")
|
| 235 |
# IFSC = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'IFSC')
|
| 236 |
+
result = {"attachment_num":pan_num,
|
| 237 |
+
"attachment_status":200}
|
| 238 |
if self.name == "gst":
|
| 239 |
gstin_num = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'GSTIN')
|
| 240 |
print("entered gst\n\n",flattened_output_list,"\n\n")
|
| 241 |
# IFSC = "".join(item['text'] for item in flattened_output_list[0]['output'] if item['label'] == 'IFSC')
|
| 242 |
+
result = {"attachemnt_num":gstin_num,
|
| 243 |
+
"attachemnt_status":200}
|
| 244 |
|
| 245 |
|
| 246 |
# if
|
multiple_request.py
CHANGED
|
@@ -1,12 +1,29 @@
|
|
| 1 |
import requests
|
| 2 |
import concurrent.futures
|
| 3 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Define the API endpoint
|
| 6 |
#http://43.204.234.114:8000/api/aadhar_ocr
|
| 7 |
# API_URL = "http://127.0.0.1:8000/api/aadhar_ocr"
|
| 8 |
-
API_URL = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Define the file paths
|
| 12 |
FILE_PATHS = {
|
|
@@ -16,13 +33,21 @@ FILE_PATHS = {
|
|
| 16 |
# "gst_file": "test_images_gst/0a52fbcb_page3_image_0.jpg",
|
| 17 |
}
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# Function to send a single POST request
|
| 20 |
def send_request():
|
| 21 |
try:
|
| 22 |
start_time = time.time()
|
| 23 |
# Open files dynamically for each request
|
| 24 |
files = {key: open(path, "rb") for key, path in FILE_PATHS.items()}
|
| 25 |
-
response = requests.post(API_URL, files=files)
|
| 26 |
print("this is response\n\n",response)
|
| 27 |
end_time = time.time()
|
| 28 |
print(f"\nTime taken for one request: {end_time - start_time:.2f} seconds")
|
|
|
|
| 1 |
import requests
|
| 2 |
import concurrent.futures
|
| 3 |
import time
|
| 4 |
+
import os
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
load_dotenv()
|
| 7 |
+
|
| 8 |
+
# Access variables
|
| 9 |
+
dummy_key = os.getenv("dummy_key")
|
| 10 |
+
HUGGINGFACE_AUTH_TOKEN = dummy_key
|
| 11 |
+
print("dummy_key",dummy_key)
|
| 12 |
|
| 13 |
# Define the API endpoint
|
| 14 |
#http://43.204.234.114:8000/api/aadhar_ocr
|
| 15 |
# API_URL = "http://127.0.0.1:8000/api/aadhar_ocr"
|
| 16 |
+
API_URL = "https://auditedge-optimised-ocr.hf.space/api/aadhar_ocr"
|
| 17 |
+
|
| 18 |
+
auth_token = HUGGINGFACE_AUTH_TOKEN # Replace with your actual token
|
| 19 |
+
|
| 20 |
+
# Request Headers
|
| 21 |
+
headers = {
|
| 22 |
+
"Authorization": f"Bearer {auth_token}"}
|
| 23 |
+
|
| 24 |
|
| 25 |
+
response = requests.get(API_URL,headers=headers)
|
| 26 |
+
print("this is response\n\n",response.text)
|
| 27 |
|
| 28 |
# Define the file paths
|
| 29 |
FILE_PATHS = {
|
|
|
|
| 33 |
# "gst_file": "test_images_gst/0a52fbcb_page3_image_0.jpg",
|
| 34 |
}
|
| 35 |
|
| 36 |
+
files = {key: open(path, "rb") for key, path in FILE_PATHS.items()}
|
| 37 |
+
response = requests.post(API_URL,headers=headers, files=files)
|
| 38 |
+
print(response.text)
|
| 39 |
+
# import sys
|
| 40 |
+
# sys.exit()
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
| 44 |
# Function to send a single POST request
|
| 45 |
def send_request():
|
| 46 |
try:
|
| 47 |
start_time = time.time()
|
| 48 |
# Open files dynamically for each request
|
| 49 |
files = {key: open(path, "rb") for key, path in FILE_PATHS.items()}
|
| 50 |
+
response = requests.post(API_URL,headers=headers, files=files)
|
| 51 |
print("this is response\n\n",response)
|
| 52 |
end_time = time.time()
|
| 53 |
print(f"\nTime taken for one request: {end_time - start_time:.2f} seconds")
|