SalmanML commited on
Commit
8a46e51
1 Parent(s): 2085f26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -31,6 +31,11 @@ from PIL import Image
31
  import streamlit as st
32
  # import os
33
 
 
 
 
 
 
34
  # key=os.environ.getattribute("api_key")
35
  # print(key)
36
  API_URL = "https://api-inference.huggingface.co/models/flair/ner-english-large"
@@ -42,9 +47,9 @@ def image_upload_and_ocr(reader):
42
  if uploaded_file is not None:
43
  image=Image.open(uploaded_file)
44
  image=image.resize((640,480))
45
- result = reader.readtext(image)
46
- result2=result
47
- texts = [item[1] for item in result]
48
  result=' '.join(texts)
49
  return result,result2
50
 
@@ -90,8 +95,7 @@ def drawing_detection(image):
90
  st.image(image,caption='Detected text on the card ',width=710)
91
  return image
92
 
93
- # Load the EasyOCR reader
94
- reader = easyocr.Reader(['en'])
95
 
96
  st.title("_Business_ card data extractor using opencv and streamlit :sunglasses:")
97
  result,result2=image_upload_and_ocr(reader)
 
31
  import streamlit as st
32
  # import os
33
 
34
+
35
+ # Load the EasyOCR reader
36
+ reader = easyocr.Reader(['en'])
37
+
38
+
39
  # key=os.environ.getattribute("api_key")
40
  # print(key)
41
  API_URL = "https://api-inference.huggingface.co/models/flair/ner-english-large"
 
47
  if uploaded_file is not None:
48
  image=Image.open(uploaded_file)
49
  image=image.resize((640,480))
50
+ result2 = reader.readtext(image)
51
+ # result2=result
52
+ texts = [item[1] for item in result2]
53
  result=' '.join(texts)
54
  return result,result2
55
 
 
95
  st.image(image,caption='Detected text on the card ',width=710)
96
  return image
97
 
98
+
 
99
 
100
  st.title("_Business_ card data extractor using opencv and streamlit :sunglasses:")
101
  result,result2=image_upload_and_ocr(reader)