Skip to content

Commit

Permalink
chore: Update Dockerfile and docker-compose.yml for Gradio server por…
Browse files Browse the repository at this point in the history
…t configuration
  • Loading branch information
knowsuchagency committed Jun 9, 2024
1 parent 2e2148b commit f9493cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
web:
build: .
ports:
- "8080:7860"
- "8080:8080"
environment:
GEMINI_API_KEY: ${GEMINI_API_KEY}

3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down

0 comments on commit f9493cb

Please sign in to comment.