Spaces:
Running
on
Zero
Running
on
Zero
Proposed replacements for methods removed from `processing_utils` in `gradio` 4.0
Browse filesThese changes are needed because we no longer work with base64 representations at all, instead we directly upload images and send filepaths back and forth. These changes should fix the errors that we're seeing in the logs, but NOTE: they have NOT been tested
app.py
CHANGED
@@ -15,6 +15,7 @@ from diffusers import (
|
|
15 |
DPMSolverMultistepScheduler, # <-- Added import
|
16 |
EulerDiscreteScheduler # <-- Added import
|
17 |
)
|
|
|
18 |
import time
|
19 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
20 |
import user_history
|
@@ -99,12 +100,13 @@ def check_inputs(prompt: str, control_image: Image.Image):
|
|
99 |
raise gr.Error("Prompt is required")
|
100 |
|
101 |
def convert_to_pil(base64_image):
|
102 |
-
pil_image =
|
103 |
return pil_image
|
104 |
|
105 |
def convert_to_base64(pil_image):
|
106 |
-
|
107 |
-
|
|
|
108 |
|
109 |
# Inference function
|
110 |
@spaces.GPU
|
|
|
15 |
DPMSolverMultistepScheduler, # <-- Added import
|
16 |
EulerDiscreteScheduler # <-- Added import
|
17 |
)
|
18 |
+
import tempfile
|
19 |
import time
|
20 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
21 |
import user_history
|
|
|
100 |
raise gr.Error("Prompt is required")
|
101 |
|
102 |
def convert_to_pil(base64_image):
|
103 |
+
pil_image = Image.open(base64_image)
|
104 |
return pil_image
|
105 |
|
106 |
def convert_to_base64(pil_image):
|
107 |
+
with tempfile.NamedTemporaryFile(suffix='.png', delete=False) as temp_file:
|
108 |
+
image.save(temp_file.name)
|
109 |
+
return temp_file.name
|
110 |
|
111 |
# Inference function
|
112 |
@spaces.GPU
|