Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -198,11 +198,17 @@ class UpscaleRequest(BaseModel):
|
|
198 |
def process_image(image_url):
|
199 |
response = requests.get(image_url)
|
200 |
img = Image.open(BytesIO(response.content))
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
202 |
filename = f"upscaled_{uuid.uuid4()}.png"
|
203 |
filepath = save_image_locally(upscaled_image, filename)
|
204 |
return filepath
|
205 |
|
|
|
206 |
@app.post("/upscale-image", response_model=dict)
|
207 |
async def upscale_image(request: UpscaleRequest, background_tasks: BackgroundTasks):
|
208 |
# Add the task directly to the background
|
|
|
198 |
def process_image(image_url):
|
199 |
response = requests.get(image_url)
|
200 |
img = Image.open(BytesIO(response.content))
|
201 |
+
if aura_sr is None:
|
202 |
+
raise RuntimeError("aura_sr is None. Check initialization.")
|
203 |
+
try:
|
204 |
+
upscaled_image = aura_sr.upscale_4x_overlapped(img)
|
205 |
+
except Exception as e:
|
206 |
+
raise RuntimeError(f"Error during upscaling: {str(e)}")
|
207 |
filename = f"upscaled_{uuid.uuid4()}.png"
|
208 |
filepath = save_image_locally(upscaled_image, filename)
|
209 |
return filepath
|
210 |
|
211 |
+
|
212 |
@app.post("/upscale-image", response_model=dict)
|
213 |
async def upscale_image(request: UpscaleRequest, background_tasks: BackgroundTasks):
|
214 |
# Add the task directly to the background
|