osanseviero HF staff commited on
Commit
431240c
1 Parent(s): e851c5f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -77,15 +77,19 @@ model=torch.load("model-final.pth",map_location ='cpu')
77
 
78
  import streamlit as st
79
  st.title("Image Colorizer")
80
-
81
- file=st.file_uploader("Please upload the B/W image",type=["jpg","jpeg","png"])
82
- print(file)
83
- if file is None:
84
- st.text("Please Upload an image")
85
- else:
86
- file_bytes = np.asarray(bytearray(file.read()), dtype=np.uint8)
87
- opencv_image = cv2.imdecode(file_bytes, 1)
88
- im=colorize(opencv_image)
 
 
 
 
 
89
  st.image(im)
90
  st.text("Colorized!!")
91
- # st.image(file)
 
77
 
78
  import streamlit as st
79
  st.title("Image Colorizer")
80
+ st.write('\n')
81
+ st.write('Find more info at: https://github.com/Pranav082001/Neural-Image-Colorizer or at https://medium.com/@pranav.kushare2001/colorize-your-black-and-white-photos-using-ai-4652a34e967.')
82
+
83
+ # Sidebar
84
+ st.sidebar.title("Upload Image")
85
+ file=st.sidebar.file_uploader("Please upload a Black and White image",type=["jpg","jpeg","png"])
86
+
87
+ if st.sidebar.button("Colorize image"):
88
+ with st.spinner('Colorizing...'):
89
+ file_bytes = np.asarray(bytearray(file.read()), dtype=np.uint8)
90
+ opencv_image = cv2.imdecode(file_bytes, 1)
91
+ im=colorize(opencv_image)
92
+ st.image(file)
93
+ st.text("Original!!")
94
  st.image(im)
95
  st.text("Colorized!!")