feat: Work with png and jpg
This commit is contained in:
parent
4ac7e2ec53
commit
7620fd6679
11
apis.py
11
apis.py
|
@ -97,9 +97,16 @@ menuLLM=""" <option value="meta-llama/Meta-Llama-3.1-70B-Instruct">meta-l
|
|||
|
||||
@app.post("/uploadimg")
|
||||
def upload_image(image: UploadFile = File(...),type="factura"):
|
||||
endfile=".jpg"
|
||||
if image.headers['content-type']=='image/png':
|
||||
endfile=".png"
|
||||
elif image.headers['content-type']=='image/jpeg':
|
||||
endfile=".jpg"
|
||||
else:
|
||||
return JSONResponse(content={
|
||||
"message": f"The file should be png or jpg"
|
||||
}, status_code=500)
|
||||
|
||||
t=time.time()
|
||||
print(image.headers)
|
||||
try:
|
||||
# Create a temporary file to store the uploaded audio
|
||||
headfilename=uuid.uuid4()
|
||||
|
|
Loading…
Reference in New Issue