Spaces:
Sleeping
Sleeping
francescoKrnl
commited on
Commit
•
758df81
1
Parent(s):
dc2215c
Update app.py
Browse files
app.py
CHANGED
@@ -32,11 +32,11 @@ 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 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 |
-
image = image.convert("RGB")
|
40 |
image_t = TF.to_tensor(image) > 0.5
|
41 |
with torch.no_grad():
|
42 |
c_t = image_t.unsqueeze(0).cuda().float()
|
@@ -187,7 +187,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
187 |
item = gr.Radio(choices=ITEMS_NAMES, value=DEFAULT_ITEM_NAME, show_label=False, container=False)
|
188 |
|
189 |
demo.load(None,None,None,js=scripts)
|
190 |
-
inputs = [image
|
191 |
outputs = [result]
|
192 |
item.change(fn=run, inputs=inputs, outputs=outputs)
|
193 |
image.change(fn=run, inputs=inputs, outputs=outputs, trigger_mode="always_last")
|
|
|
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 |
+
image = image["composite"].convert("RGB")
|
40 |
image_t = TF.to_tensor(image) > 0.5
|
41 |
with torch.no_grad():
|
42 |
c_t = image_t.unsqueeze(0).cuda().float()
|
|
|
187 |
item = gr.Radio(choices=ITEMS_NAMES, value=DEFAULT_ITEM_NAME, show_label=False, container=False)
|
188 |
|
189 |
demo.load(None,None,None,js=scripts)
|
190 |
+
inputs = [image, item]
|
191 |
outputs = [result]
|
192 |
item.change(fn=run, inputs=inputs, outputs=outputs)
|
193 |
image.change(fn=run, inputs=inputs, outputs=outputs, trigger_mode="always_last")
|