Spaces:
Sleeping
Sleeping
chage location to store image
Browse files
main.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import cv2
|
|
|
2 |
import numpy as np
|
3 |
from pyzbar.pyzbar import decode
|
4 |
from fastapi import FastAPI, File, UploadFile
|
@@ -93,8 +94,10 @@ app = FastAPI()
|
|
93 |
|
94 |
@app.post("/")
|
95 |
async def upload_image(image: UploadFile = File(...)):
|
|
|
|
|
96 |
# 画像ファイルの内容を保存または処理する
|
97 |
-
with open(
|
98 |
shutil.copyfileobj(image.file, buffer)
|
99 |
result = qrdec(image.filename)
|
100 |
logger.info(f"response : {result}")
|
|
|
1 |
import cv2
|
2 |
+
import os
|
3 |
import numpy as np
|
4 |
from pyzbar.pyzbar import decode
|
5 |
from fastapi import FastAPI, File, UploadFile
|
|
|
94 |
|
95 |
@app.post("/")
|
96 |
async def upload_image(image: UploadFile = File(...)):
|
97 |
+
temp_file_path = os.path.join('/tmp', image.filename)
|
98 |
+
|
99 |
# 画像ファイルの内容を保存または処理する
|
100 |
+
with open(temp_file_path, "wb") as buffer:
|
101 |
shutil.copyfileobj(image.file, buffer)
|
102 |
result = qrdec(image.filename)
|
103 |
logger.info(f"response : {result}")
|