Spaces:
Running
Running
Update app.py
Browse files1 unmodified line234567833 unmodified lines42434445464748495051525354555629 unmodified lines8687887980818283848586899091921 unmodified linefrom PIL import Imageimport rembgimport ioimport tempfile
def process_image(image, outline_size, outline_color, add_outline): if image is None:33 unmodified lines
return final_img
# Handle downloaddef download_sticker(image): if image: # Save image to a temporary file temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".png") image.save(temp_file.name, format="PNG") temp_file.close() return temp_file.name # Return the file path
# Gradio Interfacewith gr.Blocks(title="Sticker Maker") as interface: gr.Markdown("# Sticker Maker")29 unmodified lines outputs=output_image, )
# Handle download def download_sticker(image): if image: img_byte_arr = io.BytesIO() image.save(img_byte_arr, format="PNG") img_byte_arr.seek(0) return img_byte_arr
# Enable download functionality download_btn.click( fn=download_sticker, inputs=output_image,app.py+11-8