feat: Work with png and jpg

This commit is contained in:
Mario Gil 2024-09-10 15:52:30 -05:00
parent 4ac7e2ec53
commit 7620fd6679
1 changed files with 9 additions and 2 deletions

11
apis.py
View File

@ -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()