File size: 1,058 Bytes
38bced6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb5cd7b
38bced6
2a85dfd
 
1f38cef
2a85dfd
424046e
 
 
2a85dfd
 
 
38bced6
eb5cd7b
38bced6
 
 
 
 
 
 
919f19c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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"]