Spaces:
Runtime error
Runtime error
Commit ·
3c39785
1
Parent(s): 16fa93e
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,26 +86,26 @@ if __name__ == "__main__":
|
|
| 86 |
|
| 87 |
colA, colB = st.columns(2)
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
result = inpainting(image, mask_image, prompt, negative_prompt)
|
| 100 |
-
st.session_state["result"] = result
|
| 101 |
-
else:
|
| 102 |
-
result = None
|
| 103 |
-
|
| 104 |
-
with colB:
|
| 105 |
-
st.write("## Generated image")
|
| 106 |
-
st.write("The generated image will appear here.")
|
| 107 |
-
if webcam:
|
| 108 |
st.image(webcam)
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
| 86 |
|
| 87 |
colA, colB = st.columns(2)
|
| 88 |
|
| 89 |
+
if webcam:
|
| 90 |
+
with colA:
|
| 91 |
+
st.write("## Webcam image")
|
| 92 |
+
st.write("You can draw the mask on the image below.")
|
| 93 |
+
image = decode_image(webcam.getvalue())
|
| 94 |
+
|
| 95 |
+
canvas = make_canvas(image)
|
| 96 |
+
|
| 97 |
+
if st.button("Inpaint"):
|
| 98 |
+
st.write("Start inpainting process")
|
| 99 |
+
mask_image = get_mask(np.array(canvas.image_data))
|
| 100 |
+
result = inpainting(image, mask_image, prompt, negative_prompt)
|
| 101 |
+
st.session_state["result"] = result
|
| 102 |
+
else:
|
| 103 |
+
result = None
|
| 104 |
|
| 105 |
+
with colB:
|
| 106 |
+
st.write("## Generated image")
|
| 107 |
+
st.write("The generated image will appear here.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
st.image(webcam)
|
| 109 |
+
if 'result' in st.session_state:
|
| 110 |
+
print("Showing result")
|
| 111 |
+
st.image(st.session_state["result"])
|