ahmedmbutt commited on
Commit
672243b
·
verified ·
1 Parent(s): 25ff54e

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -8
main.py CHANGED
@@ -1,5 +1,4 @@
1
- from fastapi import FastAPI, Request, Form, File, UploadFile
2
- from fastapi.responses import StreamingResponse
3
  from contextlib import asynccontextmanager
4
  from starlette.middleware.cors import CORSMiddleware
5
 
@@ -59,8 +58,8 @@ async def text_to_image(
59
 
60
  bytes = BytesIO()
61
  image.save(bytes, "PNG")
62
- bytes.seek(0)
63
- return StreamingResponse(bytes, media_type="image/png")
64
 
65
 
66
  @app.post("/image-to-image/")
@@ -85,8 +84,8 @@ async def image_to_image(
85
 
86
  bytes = BytesIO()
87
  image.save(bytes, "PNG")
88
- bytes.seek(0)
89
- return StreamingResponse(bytes, media_type="image/png")
90
 
91
 
92
  @app.post("/inpainting/")
@@ -116,5 +115,5 @@ async def inpainting(
116
 
117
  bytes = BytesIO()
118
  image.save(bytes, "PNG")
119
- bytes.seek(0)
120
- return StreamingResponse(bytes, media_type="image/png")
 
1
+ from fastapi import FastAPI, Request, Response, Form, File, UploadFile
 
2
  from contextlib import asynccontextmanager
3
  from starlette.middleware.cors import CORSMiddleware
4
 
 
58
 
59
  bytes = BytesIO()
60
  image.save(bytes, "PNG")
61
+ # bytes.seek(0)
62
+ return Response(bytes, media_type="image/png")
63
 
64
 
65
  @app.post("/image-to-image/")
 
84
 
85
  bytes = BytesIO()
86
  image.save(bytes, "PNG")
87
+ # bytes.seek(0)
88
+ return Response(bytes, media_type="image/png")
89
 
90
 
91
  @app.post("/inpainting/")
 
115
 
116
  bytes = BytesIO()
117
  image.save(bytes, "PNG")
118
+ # bytes.seek(0)
119
+ return Response(bytes, media_type="image/png")