We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1fec276 commit cc13ec5Copy full SHA for cc13ec5
main.py
@@ -1,6 +1,9 @@
1
+import io
2
from typing import Annotated
3
-from fastapi import FastAPI, File
4
+from fastapi import FastAPI, File, UploadFile
5
+
6
+from sgf.process_image import process_image
7
8
app = FastAPI()
9
@@ -11,6 +14,11 @@ def health_check():
11
14
12
15
13
16
@app.post('/capture/')
-def capture(image: Annotated[bytes, File()]):
- print(f'{len(image)=}')
- return {'status': 'success'}
17
+def capture(image: Annotated[UploadFile, File()]):
18
+ output_file = io.StringIO()
19
+ process_image(image.file, output_file)
20
+ output_file.seek(0)
21
+ return {
22
+ 'sgf': output_file.read(),
23
+ 'image_filename': image.filename,
24
+ }
0 commit comments