Upload app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,7 @@ def local_css(file_name):
|
|
14 |
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
|
15 |
|
16 |
st.set_page_config(
|
17 |
-
page_title="Streamlit iCodeIdoia -
|
18 |
-
page_icon="images/ilpicon1.png",layout="wide",initial_sidebar_state="expanded"
|
19 |
)
|
20 |
|
21 |
st.image("images/banner.jpg")
|
@@ -25,7 +24,7 @@ local_css("styles/style.css")
|
|
25 |
|
26 |
@st.cache_resource
|
27 |
def load_model():
|
28 |
-
reader = ocr.Reader(['en'],model_storage_directory='.')
|
29 |
return reader
|
30 |
|
31 |
reader = load_model() #load model
|
@@ -36,10 +35,10 @@ tab1, tab2 = st.tabs(["Demo","Application"])
|
|
36 |
with tab1:
|
37 |
# Handle first image
|
38 |
|
39 |
-
url = "
|
40 |
|
41 |
st.subheader("OCR an image demo")
|
42 |
-
img_description = st.text('Image text will
|
43 |
|
44 |
if st.button('OCR Demo'):
|
45 |
response = requests.get(url)
|
@@ -61,8 +60,8 @@ with tab1:
|
|
61 |
|
62 |
with tab2:
|
63 |
st.subheader("OCR an image app")
|
64 |
-
img_description = st.text('Image text will be extracted using OCR.')
|
65 |
-
uploaded_file = st.file_uploader("Upload a image to OCR.", type=['jpg'
|
66 |
|
67 |
if uploaded_file is not None:
|
68 |
img = Image.open(uploaded_file)
|
|
|
14 |
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
|
15 |
|
16 |
st.set_page_config(
|
17 |
+
page_title="Streamlit iCodeIdoia - Image2OCR Extract text from an image"
|
|
|
18 |
)
|
19 |
|
20 |
st.image("images/banner.jpg")
|
|
|
24 |
|
25 |
@st.cache_resource
|
26 |
def load_model():
|
27 |
+
reader = ocr.Reader(['en'],model_storage_directory='.',gpu=False)
|
28 |
return reader
|
29 |
|
30 |
reader = load_model() #load model
|
|
|
35 |
with tab1:
|
36 |
# Handle first image
|
37 |
|
38 |
+
url = "https://raw.githubusercontent.com/webdevserv/image2OCR/main/images/ocr.jpg"
|
39 |
|
40 |
st.subheader("OCR an image demo")
|
41 |
+
img_description = st.text('Image text will extracted using OCR.')
|
42 |
|
43 |
if st.button('OCR Demo'):
|
44 |
response = requests.get(url)
|
|
|
60 |
|
61 |
with tab2:
|
62 |
st.subheader("OCR an image app")
|
63 |
+
img_description = st.text('Image text will be extracted using OCR. Warning: It might take an awful long time it is not GPU enabled.')
|
64 |
+
uploaded_file = st.file_uploader("Upload a image to OCR.", type=['jpg'])
|
65 |
|
66 |
if uploaded_file is not None:
|
67 |
img = Image.open(uploaded_file)
|