905saini commited on
Commit
794a732
·
1 Parent(s): 8047e67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -2,4 +2,24 @@ import streamlit as st
2
  import tensorflow as tf
3
  from PIL import Image
4
  import cv2
5
- model = tf.saved_model.load("best_saved_model") #Loading the saved model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  import tensorflow as tf
3
  from PIL import Image
4
  import cv2
5
+ model = tf.saved_model.load("best_saved_model") #Loading the saved model
6
+
7
+ def process_img(img_path):
8
+ img = cv2.imread(img_path) # reading the image
9
+ #copy_img = img.copy() # save a copy of image to plot result
10
+ img = cv2.resize(img,(640,640)) # resize the image as reqired for the model input
11
+ copy_img = img.copy()
12
+ img = img/255 # Normalizing the picel value
13
+ img = img.astype("float32") # Convert the format double to format float
14
+ img = np.expand_dims(img,axis=0) # exapanding dimension to add batch
15
+ return img,copy_img
16
+
17
+ st.title("Table Extract")
18
+ file_name = st.file_uploader("Upload a repport image")
19
+
20
+ if file_name is not None:
21
+ col1, col2 = st.columns(2)
22
+
23
+ image = Image.open(file_name)
24
+ col1.image(image, use_column_width=True)
25
+