Spaces:
Sleeping
Sleeping
francescoKrnl
commited on
Commit
•
4f3b924
1
Parent(s):
7c05f48
Update app.py
Browse files
app.py
CHANGED
@@ -32,13 +32,13 @@ def pil_image_to_data_uri(img, format='PNG'):
|
|
32 |
def run(image, item_name):
|
33 |
print("sketch updated")
|
34 |
print(image)
|
35 |
-
if image["
|
36 |
ones = Image.new("L", (512, 512), 255)
|
37 |
return ones
|
38 |
prompt = item_name + " professional 3d model. octane render, highly detailed, volumetric, dramatic lighting"
|
39 |
-
inverted_image = ImageOps.invert(image["
|
40 |
-
|
41 |
-
image_t = TF.to_tensor(
|
42 |
with torch.no_grad():
|
43 |
c_t = image_t.unsqueeze(0).cuda().float()
|
44 |
torch.manual_seed(42)
|
@@ -177,7 +177,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
177 |
with gr.Group(elem_id="input_image_container", elem_classes="image_container" ):
|
178 |
image = gr.Sketchpad(type="pil", image_mode="L",container=False, height="100%", width="100%",
|
179 |
# invert_colors=True, shape=(512, 512), brush_radius=4,
|
180 |
-
interactive=True, show_download_button=
|
181 |
gr.HTML("""<img src="file=assets/drawCta.png" id="draw_cta" alt="draw here image" />""",elem_id="draw_cta_container")
|
182 |
gr.HTML("""<button id="eraser" onclick="return DELETE_SKETCH_FUNCTION(this)">
|
183 |
<span id="eraser_icon"></span>
|
|
|
32 |
def run(image, item_name):
|
33 |
print("sketch updated")
|
34 |
print(image)
|
35 |
+
if image["composite"] is None:
|
36 |
ones = Image.new("L", (512, 512), 255)
|
37 |
return ones
|
38 |
prompt = item_name + " professional 3d model. octane render, highly detailed, volumetric, dramatic lighting"
|
39 |
+
inverted_image = ImageOps.invert(image["composite"])
|
40 |
+
converted_image = inverted_image.convert("RGB")
|
41 |
+
image_t = TF.to_tensor(converted_image) > 0.5
|
42 |
with torch.no_grad():
|
43 |
c_t = image_t.unsqueeze(0).cuda().float()
|
44 |
torch.manual_seed(42)
|
|
|
177 |
with gr.Group(elem_id="input_image_container", elem_classes="image_container" ):
|
178 |
image = gr.Sketchpad(type="pil", image_mode="L",container=False, height="100%", width="100%",
|
179 |
# invert_colors=True, shape=(512, 512), brush_radius=4,
|
180 |
+
interactive=True, show_download_button=True, elem_id="input_image", show_label=False)
|
181 |
gr.HTML("""<img src="file=assets/drawCta.png" id="draw_cta" alt="draw here image" />""",elem_id="draw_cta_container")
|
182 |
gr.HTML("""<button id="eraser" onclick="return DELETE_SKETCH_FUNCTION(this)">
|
183 |
<span id="eraser_icon"></span>
|