mallelapreethi commited on
Commit
deac01f
·
verified ·
1 Parent(s): f66d1ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -73,7 +73,6 @@ uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png
73
 
74
  if uploaded_file is not None:
75
  image = np.array(Image.open(uploaded_file))
76
- st.image(image, caption='Uploaded Image', use_column_width=True)
77
 
78
  st.write("Converting...")
79
 
@@ -87,15 +86,13 @@ if uploaded_file is not None:
87
  st.image(sketch, caption='Sketch', use_column_width=True)
88
 
89
  # Provide a download link for the sketch image
90
- im_pil = Image.fromarray(sketch)
91
- im_pil.save("sketch.png")
92
- with open("sketch.png", "rb") as file:
93
- btn = st.download_button(
94
- label="Download Sketch",
95
- data=file,
96
- file_name="sketch.png",
97
- mime="image/png"
98
- )
99
  else:
100
  st.info("Please upload an image to convert.")
101
 
 
73
 
74
  if uploaded_file is not None:
75
  image = np.array(Image.open(uploaded_file))
 
76
 
77
  st.write("Converting...")
78
 
 
86
  st.image(sketch, caption='Sketch', use_column_width=True)
87
 
88
  # Provide a download link for the sketch image
89
+ st.markdown("<br>", unsafe_allow_html=True) # Add some space before the button
90
+ btn = st.download_button(
91
+ label="Download Sketch",
92
+ data=Image.fromarray(sketch).tobytes(),
93
+ file_name="sketch.png",
94
+ mime="image/png"
95
+ )
 
 
96
  else:
97
  st.info("Please upload an image to convert.")
98