Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
e56af76
1
Parent(s):
18274c1
Proposed replacements for methods removed from `processing_utils` in `gradio` 4.0 (#802)
Browse files- Proposed replacements for methods removed from `processing_utils` in `gradio` 4.0 (e843d7916e5f3a2a15907e0a4e1b2186f796915e)
Co-authored-by: Abubakar Abid <abidlabs@users.noreply.huggingface.co>
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
|