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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -43
app.py CHANGED
@@ -127,6 +127,8 @@ if selected_type == "Upload Image":
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))
@@ -156,52 +158,14 @@ if selected_type == "Upload Image":
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)
163
- img_base64.save(downloaded_image, format="JPEG")
164
 
165
 
166
- final_image = Image.open(downloaded_image)
167
- print("Opening ",final_image)
168
- st.markdown("---")
169
- st.image(final_image, caption='This is how your final image looks like πŸ˜‰')
170
- with open(downloaded_image, "rb") as file:
171
- if uploaded_file.name.endswith('.jpg') or uploaded_file.name.endswith('.JPG'):
172
- if st.download_button(
173
- label="Download Output Image πŸ“·",
174
- data=file,
175
- file_name=str("output_"+uploaded_file.name),
176
- mime='image/jpg'
177
- ):
178
- download_success()
179
- if uploaded_file.name.endswith('.jpeg') or uploaded_file.name.endswith('.JPEG'):
180
- if st.download_button(
181
- label="Download Output Image πŸ“·",
182
- data=file,
183
- file_name=str("output_"+uploaded_file.name),
184
- mime='image/jpeg'
185
- ):
186
- download_success()
187
-
188
- if uploaded_file.name.endswith('.png') or uploaded_file.name.endswith('.PNG'):
189
- if st.download_button(
190
- label="Download Output Image πŸ“·",
191
- data=file,
192
- file_name=str("output_"+uploaded_file.name),
193
- mime='image/png'
194
- ):
195
- download_success()
196
-
197
- if uploaded_file.name.endswith('.bmp') or uploaded_file.name.endswith('.BMP'):
198
- if st.download_button(
199
- label="Download Output Image πŸ“·",
200
- data=file,
201
- file_name=str("output_"+uploaded_file.name),
202
- mime='image/bmp'
203
- ):
204
- download_success()
205
  else:
206
  st.warning('⚠ Please upload your Image 😯')
207
 
 
127
  # f.write((uploaded_file).getbuffer())
128
  image = Image.open(uploaded_file).convert('RGB')
129
  st.image(image, use_column_width=True)
130
+
131
+ st.write(FINAL(image))
132
 
133
  #with st.spinner(f"Working... πŸ’«"):
134
  # uploaded_image = os.path.abspath(os.path.join(upload_path,uploaded_file.name))
 
158
 
159
  # img = cv2.imdecode(img, cv2.IMREAD_COLOR)
160
 
161
+ #results = FINAL(image)
162
 
163
+ #for img in results.imgs:
164
+ #img_base64 = Image.fromarray(img)
165
+ #img_base64.save(downloaded_image, format="JPEG")
166
 
167
 
168
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  else:
170
  st.warning('⚠ Please upload your Image 😯')
171