Dash-inc commited on
Commit
9abdb46
·
verified ·
1 Parent(s): 19f8479

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -2
main.py CHANGED
@@ -191,10 +191,14 @@ async def generate_image(request: ImageRequest):
191
  "file_url": file_url,
192
  }
193
 
 
 
 
 
194
  @app.post("/upscale-image", response_model=dict)
195
- async def upscale_image(image_url: str, background_tasks: BackgroundTasks):
196
  def process_image():
197
- response = requests.get(image_url)
198
  img = Image.open(BytesIO(response.content))
199
  upscaled_image = aura_sr.upscale_4x_overlapped(img)
200
  filename = f"upscaled_{uuid.uuid4()}.png"
@@ -206,6 +210,7 @@ async def upscale_image(image_url: str, background_tasks: BackgroundTasks):
206
  return {"status": "Processing"}
207
 
208
 
 
209
  @app.get("/")
210
  async def root():
211
  return {"message": "API is up and running!"}
 
191
  "file_url": file_url,
192
  }
193
 
194
+ class UpscaleRequest(BaseModel):
195
+ image_url: str
196
+
197
+
198
  @app.post("/upscale-image", response_model=dict)
199
+ async def upscale_image(request: UpscaleRequest, background_tasks: BackgroundTasks):
200
  def process_image():
201
+ response = requests.get(request.image_url)
202
  img = Image.open(BytesIO(response.content))
203
  upscaled_image = aura_sr.upscale_4x_overlapped(img)
204
  filename = f"upscaled_{uuid.uuid4()}.png"
 
210
  return {"status": "Processing"}
211
 
212
 
213
+
214
  @app.get("/")
215
  async def root():
216
  return {"message": "API is up and running!"}