Spaces:
Sleeping
Sleeping
Durand D'souza commited on
Generated requirements.txt to avoid uv in HF-spaces
Browse filesFiles changed (2)
- Dockerfile+9-35
- requirements.txtAdded+263
1234567891011121314151617181920212223242526272829303132333435363738394041# Use a Python image with uv pre-installedFROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim# Create a non-root userRUN useradd -m -s /bin/bash app_user# Install the project into `/app`WORKDIR /app# Enable bytecode compilationENV UV_COMPILE_BYTECODE=1# Copy from the cache instead of linking since it's a mounted volumeENV UV_LINK_MODE=copy# Install the project's dependencies using the lockfile and settingsRUN --mount=type=cache,target=/root/.cache/uv \--mount=type=bind,source=uv.lock,target=uv.lock \--mount=type=bind,source=pyproject.toml,target=pyproject.toml \uv sync --frozen --no-install-project --no-dev# Then, add the rest of the project source code and install itADD . /appRUN --mount=type=cache,target=/root/.cache/uv \uv sync --frozen --no-dev# Set proper permissionsRUN chown -R app_user:app_user /app && \chmod -R 755 /app# Switch to non-root userUSER app_user# Place executables in the environment at the front of the pathENV PATH="/app/.venv/bin:$PATH"# Reset the entrypointENTRYPOINT []# Start the FastAPI appCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]123456789101112131415# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker# you will also find guides on how best to write your DockerfileFROM python:3.12# The two following lines are requirements for the Dev Mode to be functional# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorersRUN useradd -m -u 1000 userWORKDIR /appCOPY --chown=user ./requirements.txt requirements.txtRUN pip install --no-cache-dir --upgrade -r requirements.txtCOPY --chown=user . /appCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263# This file was autogenerated by uv via the following command:# uv pip compile pyproject.toml -o requirements.txtaiofiles==23.2.1 # via gradioannotated-types==0.7.0 # via pydanticanyio==4.4.0 # via # gradio # httpx # starlette # watchfilesasttokens==2.4.1 # via stack-datacertifi==2024.7.4 # via # httpcore # httpx # requestscharset-normalizer==3.3.2 # via requestsclick==8.1.7 # via # typer # uvicorncomm==0.2.2 # via ipykerneldebugpy==1.8.8 # via ipykerneldecorator==5.1.1 # via ipythondnspython==2.7.0 # via email-validatoremail-validator==2.2.0 # via fastapiexecuting==2.1.0 # via stack-datafastapi==0.115.5 # via # renewable-lcoe-api (pyproject.toml) # gradiofastapi-cli==0.0.5 # via fastapiffmpy==0.4.0 # via gradiofilelock==3.15.4 # via huggingface-hubfsspec==2024.6.1 # via # gradio-client # huggingface-hubgradio==5.6.0 # via renewable-lcoe-api (pyproject.toml)gradio-client==1.4.3 # via gradioh11==0.14.0 # via # httpcore # uvicornhttpcore==1.0.5 # via httpxhttptools==0.6.4 # via uvicornhttpx==0.27.2 # via # fastapi # gradio # gradio-client # safehttpxhuggingface-hub==0.26.2 # via # gradio # gradio-clientidna==3.8 # via # anyio # email-validator # httpx # requestsipykernel==6.29.5 # via renewable-lcoe-api (pyproject.toml)ipython==8.29.0 # via ipykerneljedi==0.19.2 # via ipythonjinja2==3.1.4 # via # fastapi # gradiojupyter-client==8.6.3 # via ipykerneljupyter-core==5.7.2 # via # ipykernel # jupyter-clientmarkdown-it-py==3.0.0 # via richmarkupsafe==2.1.5 # via # gradio # jinja2matplotlib-inline==0.1.7 # via # ipykernel # ipythonmdurl==0.1.2 # via markdown-it-pynest-asyncio==1.6.0 # via ipykernelnumpy==1.26.4 # via # gradio # pandas # scipyorjson==3.10.3 # via gradiopackaging==24.1 # via # gradio # gradio-client # huggingface-hub # ipykernelpandas==2.2.3 # via # renewable-lcoe-api (pyproject.toml) # gradioparso==0.8.4 # via jedipexpect==4.9.0 # via ipythonpillow==10.4.0 # via gradiopip==24.3.1 # via renewable-lcoe-api (pyproject.toml)platformdirs==3.11.0 # via jupyter-corepolars==1.13.1 # via renewable-lcoe-api (pyproject.toml)prompt-toolkit==3.0.47 # via ipythonpsutil==6.1.0 # via ipykernelptyprocess==0.7.0 # via pexpectpure-eval==0.2.3 # via stack-datapyarrow==18.0.0 # via renewable-lcoe-api (pyproject.toml)pydantic==2.9.2 # via # renewable-lcoe-api (pyproject.toml) # fastapi # gradiopydantic-core==2.23.4 # via pydanticpydub==0.25.1 # via gradiopygments==2.18.0 # via # ipython # richpython-dateutil==2.8.2 # via # jupyter-client # pandaspython-dotenv==1.0.1 # via uvicornpython-multipart==0.0.12 # via # fastapi # gradiopytz==2024.1 # via pandaspyxirr==0.10.6 # via renewable-lcoe-api (pyproject.toml)pyyaml==6.0.2 # via # gradio # huggingface-hub # uvicornpyzmq==26.2.0 # via # ipykernel # jupyter-clientrequests==2.32.3 # via huggingface-hubrich==13.8.0 # via typerruff==0.7.4 # via # renewable-lcoe-api (pyproject.toml) # gradiosafehttpx==0.1.1 # via gradioscipy==1.14.1 # via renewable-lcoe-api (pyproject.toml)semantic-version==2.10.0 # via gradioshellingham==1.5.4 # via typersix==1.16.0 # via # asttokens # python-dateutilsniffio==1.3.1 # via # anyio # httpxstack-data==0.6.3 # via ipythonstarlette==0.41.2 # via # fastapi # gradiotomlkit==0.12.0 # via gradiotornado==6.4.1 # via # ipykernel # jupyter-clienttqdm==4.66.5 # via huggingface-hubtraitlets==5.14.3 # via # comm # ipykernel # ipython # jupyter-client # jupyter-core # matplotlib-inlinetyper==0.13.0 # via # fastapi-cli # gradiotyping-extensions==4.12.2 # via # fastapi # gradio # gradio-client # huggingface-hub # ipython # pydantic # pydantic-core # typertzdata==2024.2 # via pandasurllib3==2.2.2 # via requestsuvicorn==0.32.0 # via # fastapi # fastapi-cli # gradiouvloop==0.21.0 # via uvicornwatchfiles==0.24.0 # via uvicornwcwidth==0.2.13 # via prompt-toolkitwebsockets==12.0 # via # gradio-client # uvicornDockerfile+9-35
requirements.txtAdded+263