Spaces:
Build error
Build error
gokaygokay
commited on
Commit
•
e5ccbba
1
Parent(s):
b9f8924
Update app.py
Browse files
app.py
CHANGED
@@ -128,6 +128,12 @@ def enhance_prompt(input_prompt, model_choice):
|
|
128 |
return enhanced_text
|
129 |
|
130 |
def upscale_image(image, scale):
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
if scale == 2:
|
132 |
return lazy_realesrgan_x2.predict(image)
|
133 |
elif scale == 4:
|
|
|
128 |
return enhanced_text
|
129 |
|
130 |
def upscale_image(image, scale):
|
131 |
+
# Convert to PIL Image if it's a file path
|
132 |
+
if isinstance(image, str):
|
133 |
+
image = Image.open(image).convert('RGB')
|
134 |
+
elif not isinstance(image, Image.Image):
|
135 |
+
raise ValueError("Input must be a PIL Image or a file path")
|
136 |
+
|
137 |
if scale == 2:
|
138 |
return lazy_realesrgan_x2.predict(image)
|
139 |
elif scale == 4:
|