Spaces:
Runtime error
Runtime error
Commit ·
5981c2d
1
Parent(s): 1c669b7
add docs
Browse filesFiles changed (3)
- .gitattributes+1
- app.py+9-2
- explanation.py+22-1
41 unmodified lines42434441 unmodified linescontent/output_0.png filter=lfs diff=lfs merge=lfs -textcontent/output_1.png filter=lfs diff=lfs merge=lfs -textcontent/Schermafbeelding[[:space:]]2023-05-05[[:space:]]om[[:space:]]14.29.39.png filter=lfs diff=lfs merge=lfs -text41 unmodified lines4243444541 unmodified linescontent/output_0.png filter=lfs diff=lfs merge=lfs -textcontent/output_1.png filter=lfs diff=lfs merge=lfs -textcontent/Schermafbeelding[[:space:]]2023-05-05[[:space:]]om[[:space:]]14.29.39.png filter=lfs diff=lfs merge=lfs -textcontent/* filter=lfs diff=lfs merge=lfs -text
283 unmodified lines28428528628728828929031 unmodified lines3223233243253263271 unmodified line32933033133233333432 unmodified lines367368369370283 unmodified lines"in almost 30 design styles. After fetching all these images, we started adding metadata such as ""captions (from the BLIP captioning model) and segmentation maps (from the HuggingFace UperNetForSemanticSegmentation model). ")st.write("For the gathering and inference of the metadata we used the Fondant framework (https://github.com/ml6team/fondant) made by ML6 (https://www.ml6.eu/), which is an open source ""data centric framework for data preparation. The pipeline used for training this controlnet will soon be available as an ""example pipeline within Fondant and can be easily adapted for building your own dataset.")31 unmodified linesst.session_state['example_image_0'] = Image.open("content/example_0.png")st.session_state['example_image_1'] = Image.open("content/example_1.jpg")col_im_0, col_im_1 = st.columns(2)1 unmodified linest.image(st.session_state['example_image_0'], caption="Example image 1", use_column_width=True)if st.button("Use example 1"):move_image('example_image_0', 'initial_image', remove_state=True, rerun=True)with col_im_1:st.image(st.session_state['example_image_1'], caption="Example image 2", use_column_width=True)if st.button("Use example 2"):32 unmodified linesmake_output_image()if __name__ == "__main__":main()283 unmodified lines28428528628728828929031 unmodified lines3223233243253263273281 unmodified line33033133233333433533633733833932 unmodified lines372373374375376377283 unmodified lines"in almost 30 design styles. After fetching all these images, we started adding metadata such as ""captions (from the BLIP captioning model) and segmentation maps (from the HuggingFace UperNetForSemanticSegmentation model). ")st.write("For the gathering and inference of the metadata we used the Fondant framework (https://github.com/ml6team/fondant) provided by ML6 (https://www.ml6.eu/), which is an open source ""data centric framework for data preparation. The pipeline used for training this controlnet will soon be available as an ""example pipeline within Fondant and can be easily adapted for building your own dataset.")31 unmodified linesst.session_state['example_image_0'] = Image.open("content/example_0.png")st.session_state['example_image_1'] = Image.open("content/example_1.jpg")st.session_state['example_image_2'] = Image.open("content/example_2.jpg")col_im_0, col_im_1 = st.columns(2)1 unmodified linest.image(st.session_state['example_image_0'], caption="Example image 1", use_column_width=True)if st.button("Use example 1"):move_image('example_image_0', 'initial_image', remove_state=True, rerun=True)st.image(st.session_state['example_image_2'], caption="Example image 3", use_column_width=True)if st.button("Use example 2"):move_image('example_image_2', 'initial_image', remove_state=True, rerun=True)with col_im_1:st.image(st.session_state['example_image_1'], caption="Example image 2", use_column_width=True)if st.button("Use example 2"):32 unmodified linesmake_output_image()if __name__ == "__main__":main()
26 unmodified lines2728293026 unmodified linesst.image("content/regen_example.png", caption="Room where all concepts except for 'bed', 'lamp', 'table' are regenerated")def make_segmentation_explanation():pass26 unmodified lines2728293031323334353637383940414243444546474849505126 unmodified linesst.image("content/regen_example.png", caption="Room where all concepts except for 'bed', 'lamp', 'table' are regenerated")def make_segmentation_explanation():with st.expander("Segmentation mode", expanded=False):st.write("In the segmentation mode, the user can use his imagination and the paint brush to place concepts in the image. ""In the left sidebar, you can first find the high level category of the concept you want to add, such as 'lighting', 'floor', .. ""After selecting the category, you can select the specific concept you want to add in the 'Choose a color' dropdown. ""This will change the color of the paint brush, which you can then use to draw on the input image. ""The model will then regenerate the image with the concepts you have drawn and leave the rest of the image unchanged. ")st.image("content/sidebar segmentation.png", caption="Sidebar with segmentation options", width=300)st.write("You can choose the freedraw mode which gives you a pencil of a certain (chosen) width or the polygon mode. With the polygon mode you can click to add a point to the polygon and close the polygon by right clicking. ")st.write("Important: ""it's not easy to draw a good segmentation mask. This is because you need to keep in mind the perspective of the room and the exact ""shape of the object you want to draw within this perspective. Controlnet will follow your segmentation mask pretty well, so ""a non-natural object shape will sometimes result in weird outputs. However, give it a try and see what you can do! ")st.image("content/segmentation window.png", caption="Example of a segmentation mask drawn on the input image to add a window to the room")st.write("Tip: ")st.write("In the concepts dropdown, you can select 'keep background' (which is a white color). Everything drawn in this color will use ""the original underlying segmentation mask. This can be useful to help with generating other objects, since you give the model a some ""freedom to generate outside the object borders.")st.image("content/keep background 1.png", caption="Image with a poster drawn on the wall.")st.image("content/keep background 2.png", caption="Image with a poster drawn on the wall surrounded by 'keep background'.")
.gitattributes+1
app.py+9-2
explanation.py+22-1