OmidSakaki commited on
Commit
2741559
Β·
verified Β·
1 Parent(s): b447319

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -11
app.py CHANGED
@@ -123,23 +123,40 @@ if selected_type == "Upload Image":
123
  uploaded_file = st.file_uploader("Upload Image of car's number plate πŸš“", type=["png","jpg","bmp","jpeg"])
124
 
125
  if uploaded_file is not None:
126
- with open(os.path.join(upload_path,uploaded_file.name),"wb") as f:
127
- f.write((uploaded_file).getbuffer())
128
- with st.spinner(f"Working... πŸ’«"):
129
- uploaded_image = os.path.abspath(os.path.join(upload_path,uploaded_file.name))
130
- downloaded_image = os.path.abspath(os.path.join(download_path,str("output_"+uploaded_file.name)))
 
 
 
131
 
132
- with open(uploaded_image,'rb') as image:
133
- img_bytes = image.read()
134
 
135
- img = Image.open(io.BytesIO(img_bytes))
 
 
 
136
 
 
 
137
 
138
- img = np.asarray(bytearray(img.read()), dtype=np.uint8)
 
 
 
 
 
 
 
 
 
139
 
140
- img = cv2.imdecode(img, cv2.IMREAD_COLOR)
141
 
142
- results = FINAL(img)
143
 
144
  for img in results.imgs:
145
  img_base64 = Image.fromarray(img)
 
123
  uploaded_file = st.file_uploader("Upload Image of car's number plate πŸš“", type=["png","jpg","bmp","jpeg"])
124
 
125
  if uploaded_file is not None:
126
+ #with open(os.path.join(upload_path,uploaded_file.name),"wb") as f:
127
+ # f.write((uploaded_file).getbuffer())
128
+ image = Image.open(uploaded_file).convert('RGB')
129
+ st.image(image, use_column_width=True)
130
+
131
+ #with st.spinner(f"Working... πŸ’«"):
132
+ # uploaded_image = os.path.abspath(os.path.join(upload_path,uploaded_file.name))
133
+ # downloaded_image = os.path.abspath(os.path.join(download_path,str("output_"+uploaded_file.name)))
134
 
135
+ # upload file
136
+ #file = st.file_uploader('', type=['jpeg', 'jpg', 'png'])
137
 
138
+ # display image
139
+ #if file is not None:
140
+ # image = Image.open(file).convert('RGB')
141
+ # st.image(image, use_column_width=True)
142
 
143
+ # with open(uploaded_image,'rb') as image:
144
+ # img_bytes = image.read()
145
 
146
+
147
+ # image_stream = io.BytesIO()
148
+ # image_stream.seek(0)
149
+ # file_bytes = np.asarray(bytearray(image_stream.read()), dtype=np.uint8)
150
+ # img = cv.imdecode(file_bytes, cv.IMREAD_COLOR)
151
+
152
+ # img = Image.open(io.BytesIO(img_bytes))
153
+
154
+
155
+ # img = np.asarray(bytearray(img.read()), dtype=np.uint8)
156
 
157
+ # img = cv2.imdecode(img, cv2.IMREAD_COLOR)
158
 
159
+ results = FINAL(image)
160
 
161
  for img in results.imgs:
162
  img_base64 = Image.fromarray(img)