Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__
*.pyc
*.pyo
*.swp
.env
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use the official Python 3.9 slim image as the base
FROM python:3.9-slim

# Set environment variables to prevent Python from writing .pyc files and to buffer outputs
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Set the working directory in the container
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Copy the requirements file into the container
COPY requirements.txt .

# Upgrade pip and install Python dependencies
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container
COPY . .

# Expose the port that Gradio uses
EXPOSE 7860

# Define environment variable for OpenAI API Key (to be provided at runtime)
ENV OPENAI_API_KEY=""

# Specify the command to run the application
CMD ["python", "app.py"]
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To run the PDF2Audio app:

1. Ensure you're in the project directory and your Conda environment is activated:
```
conda activate pdf2audio
conda activate pdf2audio
```

2. Run the Python script that launches the Gradio interface:
Expand All @@ -73,6 +73,24 @@ To run the PDF2Audio app:

4. Use the Gradio interface to upload a PDF file and convert it to audio.

## Using Docker

1. **Build the Docker image:**
```bash
docker build -t pdf2audio .
```

2. **Run the Docker container:**
```bash
docker run -p 7860:7860 -e OPENAI_API_KEY=your_api_key_here pdf2audio
```

- Replace `your_api_key_here` with your actual OpenAI API key.
- The `-p 7860:7860` mapping exposes port 7860 of the container to your host machine, allowing you to access the Gradio interface.

3. **Access the Gradio interface:**
Open your web browser and go to `http://localhost:7860`.

## How to Use

1. Upload one or more PDF files
Expand Down