Spaces:
Runtime error
Runtime error
Doron Adler
commited on
Commit
·
d55cf7e
1
Parent(s):
6672810
Show results from the other outputs of the model as well
Browse files
app.py
CHANGED
@@ -81,8 +81,13 @@ def face2hero(
|
|
81 |
else:
|
82 |
input = torch.Tensor(aligned_img)
|
83 |
results = model(input)
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
return output
|
88 |
|
@@ -103,8 +108,8 @@ def inference(img):
|
|
103 |
|
104 |
|
105 |
title = "Comics hero U2Net"
|
106 |
-
description = "
|
107 |
article = "<hr><p style='text-align: center'>See the <a href='https://github.com/Norod/U-2-Net-StyleTransfer' target='_blank'>Github Repo</a></p><p style='text-align: center'>samples: <img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00001.jpg' alt='Sample00001'/><img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00002.jpg' alt='Sample00002'/><img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00003.jpg' alt='Sample00003'/><img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00004.jpg' alt='Sample00004'/><img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00005.jpg' alt='Sample00005'/></p><p>The \"Comics Hero (U2Net)\" model was trained by <a href='https://linktr.ee/Norod78' target='_blank'>Doron Adler</a></p>"
|
108 |
|
109 |
examples=[['Example00001.jpg'],['Example00002.jpg'],['Example00003.jpg'],['Example00004.jpg'],['Example00005.jpg'], ['Example00006.jpg']]
|
110 |
-
gr.Interface(inference, gr.inputs.Image(type="pil",shape=(1024,1024)), gr.outputs.Image(type="pil"),title=title,description=description,article=article,examples=examples,enable_queue=True,allow_flagging=False).launch()
|
|
|
81 |
else:
|
82 |
input = torch.Tensor(aligned_img)
|
83 |
results = model(input)
|
84 |
+
d1 = array_to_image(results[0].detach().numpy())
|
85 |
+
d2 = array_to_image(results[1].detach().numpy())
|
86 |
+
d3 = array_to_image(results[2].detach().numpy())
|
87 |
+
img_with_d2 = img_concat_h(array_to_image(aligned_img), d2)
|
88 |
+
d1_with_d3 = img_concat_h(d1, d3)
|
89 |
+
output = [img_with_d2, d1_with_d3]
|
90 |
+
del results
|
91 |
|
92 |
return output
|
93 |
|
|
|
108 |
|
109 |
|
110 |
title = "Comics hero U2Net"
|
111 |
+
description = "Style transfer a face into one of a \"Comics hero\". Upload an image with a face, or click on one of the examples below. If a face could not be detected, an image will still be created."
|
112 |
article = "<hr><p style='text-align: center'>See the <a href='https://github.com/Norod/U-2-Net-StyleTransfer' target='_blank'>Github Repo</a></p><p style='text-align: center'>samples: <img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00001.jpg' alt='Sample00001'/><img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00002.jpg' alt='Sample00002'/><img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00003.jpg' alt='Sample00003'/><img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00004.jpg' alt='Sample00004'/><img src='https://hf.space/gradioiframe/Norod78/ComicsHeroU2Net/file/Sample00005.jpg' alt='Sample00005'/></p><p>The \"Comics Hero (U2Net)\" model was trained by <a href='https://linktr.ee/Norod78' target='_blank'>Doron Adler</a></p>"
|
113 |
|
114 |
examples=[['Example00001.jpg'],['Example00002.jpg'],['Example00003.jpg'],['Example00004.jpg'],['Example00005.jpg'], ['Example00006.jpg']]
|
115 |
+
gr.Interface(inference, gr.inputs.Image(type="pil",shape=(1024,1024)), [gr.outputs.Image(type="pil"),gr.outputs.Image(type="pil")],title=title,description=description,article=article,examples=examples,enable_queue=True,allow_flagging=False).launch()
|