diff --git a/Dockerfile b/Dockerfile index 93a7e20..d15a66c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,6 @@ RUN uv pip install -r requirements.txt COPY . . ENV GRADIO_SERVER_NAME="0.0.0.0" +ENV GRADIO_SERVER_PORT="8080" CMD .venv/bin/python main.py diff --git a/docker-compose.yml b/docker-compose.yml index 15e78a7..ccabeb5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ services: web: build: . ports: - - "8080:7860" + - "8080:8080" environment: GEMINI_API_KEY: ${GEMINI_API_KEY} diff --git a/main.py b/main.py index b2d875d..fb0c626 100644 --- a/main.py +++ b/main.py @@ -65,6 +65,9 @@ def get_mp3(text: str, voice: str, api_key: str = None) -> bytes: def generate_audio(file: bytes, openai_api_key: str) -> bytes: + if not os.getenv("OPENAI_API_KEY", openai_api_key): + raise gr.Error("OpenAI API key is required") + reader = PdfReader(io.BytesIO(file)) text = "\n\n".join([page.extract_text() for page in reader.pages])