Spaces:
Build error
Build error
gokaygokay
commited on
Commit
•
18fc70d
1
Parent(s):
e5ccbba
Update app.py
Browse files
app.py
CHANGED
@@ -128,11 +128,12 @@ def enhance_prompt(input_prompt, model_choice):
|
|
128 |
return enhanced_text
|
129 |
|
130 |
def upscale_image(image, scale):
|
131 |
-
#
|
132 |
-
if isinstance(image,
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
136 |
|
137 |
if scale == 2:
|
138 |
return lazy_realesrgan_x2.predict(image)
|
|
|
128 |
return enhanced_text
|
129 |
|
130 |
def upscale_image(image, scale):
|
131 |
+
# Ensure image is a PIL Image object
|
132 |
+
if not isinstance(image, Image.Image):
|
133 |
+
if isinstance(image, np.ndarray):
|
134 |
+
image = Image.fromarray(image)
|
135 |
+
else:
|
136 |
+
raise ValueError("Input must be a PIL Image or a numpy array")
|
137 |
|
138 |
if scale == 2:
|
139 |
return lazy_realesrgan_x2.predict(image)
|