Spaces:
Sleeping
Sleeping
| # Use an official Python runtime as the base image | |
| FROM python:3.9-slim | |
| # Set working directory in the container | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| espeak-ng \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Clone ParsNorm repository and install it | |
| RUN git clone https://github.com/saeedzou/ParsNorm.git \ | |
| && cd ParsNorm \ | |
| && pip install -e . \ | |
| && pip install -r requirements.txt \ | |
| && pip install fastapi uvicorn pandas | |
| # Create a writable directory for nltk_data | |
| RUN mkdir -p /app/nltk_data | |
| RUN mkdir -p /app/nltk_data/corpora | |
| # Download cmudict using NLTK Downloader | |
| RUN python -m nltk.downloader -d /app/nltk_data cmudict | |
| # Set the NLTK_DATA environment variable | |
| ENV NLTK_DATA=/app/nltk_data | |
| COPY pos_tagger.model . | |
| COPY final_map_words.csv . | |
| # Copy your Python script into the container | |
| COPY phonemizer.py . | |
| # Expose the port FastAPI will run on | |
| EXPOSE 7860 | |
| # Add Hugging Face Spaces ENTRYPOINT | |
| ENTRYPOINT ["uvicorn", "phonemizer:app", "--host", "0.0.0.0", "--port", "7860"] |