Ashrafb commited on
Commit
ad9892d
·
verified ·
1 Parent(s): 7b120ae

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -28,7 +28,7 @@ def get_caption(image_path: str, question: str):
28
  @app.post("/predict/")
29
  async def predict(image: UploadFile = File(...), question: str = Form(...)):
30
  try:
31
- with tempfile.NamedTemporaryFile(delete=False, suffix=".jpg") as temp_image:
32
  shutil.copyfileobj(image.file, temp_image)
33
  temp_image_path = temp_image.name
34
  result = get_caption(temp_image_path, question)
@@ -42,4 +42,4 @@ app.mount("/", StaticFiles(directory="static", html=True), name="static")
42
  @app.get("/")
43
  def index() -> FileResponse:
44
  return FileResponse(path="/app/static/index.html", media_type="text/html")
45
-
 
28
  @app.post("/predict/")
29
  async def predict(image: UploadFile = File(...), question: str = Form(...)):
30
  try:
31
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as temp_image:
32
  shutil.copyfileobj(image.file, temp_image)
33
  temp_image_path = temp_image.name
34
  result = get_caption(temp_image_path, question)
 
42
  @app.get("/")
43
  def index() -> FileResponse:
44
  return FileResponse(path="/app/static/index.html", media_type="text/html")
45
+