Spaces:
Running
Running
yizhangliu
commited on
Commit
·
bf8d6fe
1
Parent(s):
b192efc
Update app.py
Browse files
app.py
CHANGED
@@ -213,10 +213,11 @@ def read_content(file_path: str) -> str:
|
|
213 |
|
214 |
return content
|
215 |
|
216 |
-
def predict(dict
|
217 |
print(f'liuyz_0_', dict)
|
218 |
init_image = dict["image"] # .convert("RGB") #.resize((512, 512))
|
219 |
-
|
|
|
220 |
print(f'liuyz_2_', init_image.convert("RGB"))
|
221 |
print(f'liuyz_3_', init_image.convert("RGB").resize((512, 512)))
|
222 |
mask = dict["mask"] # .convert("RGB") #.resize((512, 512))
|
@@ -224,7 +225,7 @@ def predict(dict, prompt=""):
|
|
224 |
output = None # output.images[0]
|
225 |
# output = pipe(prompt = prompt, image=init_image, mask_image=mask,guidance_scale=7.5)
|
226 |
|
227 |
-
return output
|
228 |
|
229 |
print(f'liuyz_400_here_')
|
230 |
|
@@ -279,8 +280,8 @@ interface.launch(share=True)
|
|
279 |
|
280 |
image = gr.inputs.Image(source='upload', tool='sketch', type="pil", label="Upload")# .style(height=400)
|
281 |
demo = gr.Interface(fn=predict,
|
282 |
-
inputs=image,
|
283 |
-
outputs=image,
|
284 |
# examples=[["cheetah.jpg"]],
|
285 |
)
|
286 |
|
|
|
213 |
|
214 |
return content
|
215 |
|
216 |
+
def predict(dict):
|
217 |
print(f'liuyz_0_', dict)
|
218 |
init_image = dict["image"] # .convert("RGB") #.resize((512, 512))
|
219 |
+
target_size = (init_image.shape[0], init_image.shape[1])
|
220 |
+
print(f'liuyz_1_', init_image, target_size)
|
221 |
print(f'liuyz_2_', init_image.convert("RGB"))
|
222 |
print(f'liuyz_3_', init_image.convert("RGB").resize((512, 512)))
|
223 |
mask = dict["mask"] # .convert("RGB") #.resize((512, 512))
|
|
|
225 |
output = None # output.images[0]
|
226 |
# output = pipe(prompt = prompt, image=init_image, mask_image=mask,guidance_scale=7.5)
|
227 |
|
228 |
+
return output #, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
229 |
|
230 |
print(f'liuyz_400_here_')
|
231 |
|
|
|
280 |
|
281 |
image = gr.inputs.Image(source='upload', tool='sketch', type="pil", label="Upload")# .style(height=400)
|
282 |
demo = gr.Interface(fn=predict,
|
283 |
+
inputs=[image],
|
284 |
+
outputs=[image],
|
285 |
# examples=[["cheetah.jpg"]],
|
286 |
)
|
287 |
|