Spaces:
Runtime error
Runtime error
Update app
Browse files
app.py
CHANGED
@@ -145,23 +145,23 @@ def run_outpaint(
|
|
145 |
state,
|
146 |
):
|
147 |
base64_str = "base64"
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
if True:
|
166 |
text2img, inpaint = get_model()
|
167 |
if enable_safety:
|
@@ -243,8 +243,8 @@ outpaint_button_js = load_js("outpaint")
|
|
243 |
proceed_button_js = load_js("proceed")
|
244 |
mode_js = load_js("mode")
|
245 |
setup_button_js = load_js("setup")
|
246 |
-
|
247 |
-
|
248 |
get_model(get_token())
|
249 |
|
250 |
with blocks as demo:
|
@@ -253,7 +253,7 @@ with blocks as demo:
|
|
253 |
"""
|
254 |
**stablediffusion-infinity**: Outpainting with Stable Diffusion on an infinite canvas: [https://github.com/lkwq007/stablediffusion-infinity](https://github.com/lkwq007/stablediffusion-infinity)
|
255 |
|
256 |
-
**This Space does not have GPU at present, so it's quite slow or can only outputs red squares when the inference cannot be proceeded**
|
257 |
"""
|
258 |
)
|
259 |
# frame
|
|
|
145 |
state,
|
146 |
):
|
147 |
base64_str = "base64"
|
148 |
+
if not cuda_available:
|
149 |
+
data = base64.b64decode(str(sel_buffer_str))
|
150 |
+
pil = Image.open(io.BytesIO(data))
|
151 |
+
sel_buffer = np.array(pil)
|
152 |
+
sel_buffer[:, :, 3]=255
|
153 |
+
sel_buffer[:, :, 0]=255
|
154 |
+
out_pil = Image.fromarray(sel_buffer)
|
155 |
+
out_buffer = io.BytesIO()
|
156 |
+
out_pil.save(out_buffer, format="PNG")
|
157 |
+
out_buffer.seek(0)
|
158 |
+
base64_bytes = base64.b64encode(out_buffer.read())
|
159 |
+
base64_str = base64_bytes.decode("ascii")
|
160 |
+
return (
|
161 |
+
gr.update(label=str(state + 1), value=base64_str,),
|
162 |
+
gr.update(label="Prompt"),
|
163 |
+
state + 1,
|
164 |
+
)
|
165 |
if True:
|
166 |
text2img, inpaint = get_model()
|
167 |
if enable_safety:
|
|
|
243 |
proceed_button_js = load_js("proceed")
|
244 |
mode_js = load_js("mode")
|
245 |
setup_button_js = load_js("setup")
|
246 |
+
if not cuda_available:
|
247 |
+
get_model = lambda x:x
|
248 |
get_model(get_token())
|
249 |
|
250 |
with blocks as demo:
|
|
|
253 |
"""
|
254 |
**stablediffusion-infinity**: Outpainting with Stable Diffusion on an infinite canvas: [https://github.com/lkwq007/stablediffusion-infinity](https://github.com/lkwq007/stablediffusion-infinity)
|
255 |
|
256 |
+
**This Space does not have GPU at present, so it's unusable (quite slow or can only outputs red squares when the inference cannot be proceeded)**
|
257 |
"""
|
258 |
)
|
259 |
# frame
|