gokaygokay commited on
Commit
18fc70d
1 Parent(s): e5ccbba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
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
- # 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)
 
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)