dahyedahye commited on
Commit
f7d7ba3
·
1 Parent(s): df06ebc
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -58,12 +58,8 @@ def process_image(file: UploadFile = File(...)):
58
  edges_on_white_sobel.save(sobel_output_io, format='JPEG')
59
  sobel_output_io.seek(0)
60
 
61
- # Choose which image to return
62
- # If you want to return Canny edge detection image:
63
- # return FileResponse(canny_output_io, media_type='image/jpeg', filename="canny_edges_white_bg_image.jpg")
64
-
65
- # If you want to return Sobel edge detection image:
66
- return FileResponse(sobel_output_io, media_type='image/jpeg', filename="sobel_edges_white_bg_image.jpg")
67
-
68
  except Exception as e:
69
  return JSONResponse(status_code=500, content={"message": str(e)})
 
58
  edges_on_white_sobel.save(sobel_output_io, format='JPEG')
59
  sobel_output_io.seek(0)
60
 
61
+ # StreamingResponse를 사용하여 파일 반환
62
+ return StreamingResponse(sobel_output_io, media_type='image/jpeg')
63
+
 
 
 
 
64
  except Exception as e:
65
  return JSONResponse(status_code=500, content={"message": str(e)})