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