Spaces:
Build error
Build error
app.py
CHANGED
@@ -31,8 +31,18 @@ def read_content(file_path: str) -> str:
|
|
31 |
return content
|
32 |
|
33 |
def predict(dict, reference, scale, seed, step):
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
|
37 |
output = pipe(
|
38 |
image=init_image,
|
@@ -118,13 +128,9 @@ with image_blocks as demo:
|
|
118 |
full_width=True,
|
119 |
)
|
120 |
with gr.Group(elem_id="share-btn-container"):
|
121 |
-
community_icon = gr.HTML(community_icon_html, visible=
|
122 |
-
loading_icon = gr.HTML(loading_icon_html, visible=
|
123 |
-
share_button = gr.Button("Share to community", elem_id="share-btn", visible=
|
124 |
-
margin=False,
|
125 |
-
rounded=(False, True, True, False),
|
126 |
-
full_width=True,
|
127 |
-
)
|
128 |
|
129 |
with gr.Row():
|
130 |
gr.Examples([
|
|
|
31 |
return content
|
32 |
|
33 |
def predict(dict, reference, scale, seed, step):
|
34 |
+
width,height=dict["image"].size
|
35 |
+
if width<height:
|
36 |
+
factor=width/512.0
|
37 |
+
width=512
|
38 |
+
height=int((height/factor)/8.0)*8
|
39 |
+
|
40 |
+
else:
|
41 |
+
factor=height/512.0
|
42 |
+
height=512
|
43 |
+
width=int((width/factor)/8.0)*8
|
44 |
+
init_image = dict["image"].convert("RGB").resize((width,height))
|
45 |
+
mask = dict["mask"].convert("RGB").resize((width,height))
|
46 |
generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
|
47 |
output = pipe(
|
48 |
image=init_image,
|
|
|
128 |
full_width=True,
|
129 |
)
|
130 |
with gr.Group(elem_id="share-btn-container"):
|
131 |
+
community_icon = gr.HTML(community_icon_html, visible=True)
|
132 |
+
loading_icon = gr.HTML(loading_icon_html, visible=True)
|
133 |
+
share_button = gr.Button("Share to community", elem_id="share-btn", visible=True)
|
|
|
|
|
|
|
|
|
134 |
|
135 |
with gr.Row():
|
136 |
gr.Examples([
|