Ashrafb commited on
Commit
3df8281
·
verified ·
1 Parent(s): 47080b7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -22,11 +22,11 @@ def generate_caption(image_path):
22
 
23
  # Route to handle image uploads and generate captions
24
  @app.post("/uploadfile/")
25
- async def generate_image_caption(image: UploadFile = File(...)):
26
  try:
27
  # Save the uploaded image to a temporary file
28
  with tempfile.NamedTemporaryFile(delete=False) as temp_file:
29
- shutil.copyfileobj(image.file, temp_file)
30
  temp_file_path = temp_file.name
31
 
32
  # Generate caption for the uploaded image
 
22
 
23
  # Route to handle image uploads and generate captions
24
  @app.post("/uploadfile/")
25
+ async def generate_image_caption(file: UploadFile = File(...)):
26
  try:
27
  # Save the uploaded image to a temporary file
28
  with tempfile.NamedTemporaryFile(delete=False) as temp_file:
29
+ shutil.copyfileobj(file.file, temp_file)
30
  temp_file_path = temp_file.name
31
 
32
  # Generate caption for the uploaded image