Hi there,
I am hosting an app that extract an image from a video using fastapi. In the local, it runs perfectly。 However, I find an issue when running on space. In the log file, it shows the api request return successful response and the log shows where the file has been written. But, when I check the file, it does not exist. I wonder if anyone can spot what I am missing here?
Here is my docker file:
FROM python:3.10
RUN useradd -m -u 1000 user
WORKDIR /code
# Install libgl1-mesa-glx
RUN apt-get update && apt-get install -y libgl1-mesa-glx
COPY ./requirements.txt /code/requirements.txt
RUN python -m venv /code/venv
RUN /code/venv/bin/pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY --chown=user . /code
# Create necessary directories and set permissions before switching to non-root user
RUN mkdir -p /code/app/uploaded_videos /code/app/output_frames \
&& chown -R user:user /code
USER user
ENV PATH="/code/venv/bin:$PATH"
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
and here is the log
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:7860 (Press CTRL+C to quit)
INFO: 10.16.3.126:31565 - “GET /docs HTTP/1.1” 200 OK
INFO: 10.16.24.60:4111 - “GET /openapi.json HTTP/1.1” 200 OK
/code/venv/lib/python3.10/site-packages/torch/functional.py:512: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at …/aten/src/ATen/native/TensorShape.cpp:3587.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
./output_frames/najwa_first_frame.png
./output_frames/najwa_first_frame.png
Settings → Mode=base, Device=cpu, Torchscript=disabled
First frame saved to ./output_frames/najwa_first_frame.png
INFO: 10.16.14.230:29277 - “POST /extract_first_frame/ HTTP/1.1” 200 OK
INFO: 10.16.3.126:25274 - “GET /openapi.json HTTP/1.1” 200 OK
INFO: 10.16.40.170:4559 - “GET /openapi.json HTTP/1.1” 200 OK
as you can see the file najwa_first_frame.png was successfully saved to “./output_frames/”
But, it is not there.
Thanks
D