fastapi_ml_stablediffusion icon indicating copy to clipboard operation
fastapi_ml_stablediffusion copied to clipboard

Is there benefits for using await?

Open happyeungin opened this issue 1 year ago • 0 comments

I saw that you are using await here, Are there any benefits of doing so?

`@app.get("/api/generate/") async def generate_image(imgPromptCreate: _schemas.ImageCreate = _fapi.Depends()):

image = await _services.generate_image(imgPrompt=imgPromptCreate)

memory_stream = io.BytesIO()
image.save(memory_stream, format="PNG")
memory_stream.seek(0)
return StreamingResponse(memory_stream, media_type="image/png")`

happyeungin avatar Jul 26 '23 11:07 happyeungin