knowsuchagency commited on
Commit
f9493cb
1 Parent(s): 2e2148b

chore: Update Dockerfile and docker-compose.yml for Gradio server port configuration

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -0
  2. docker-compose.yml +1 -1
  3. main.py +3 -0
Dockerfile CHANGED
@@ -9,5 +9,6 @@ RUN uv pip install -r requirements.txt
9
  COPY . .
10
 
11
  ENV GRADIO_SERVER_NAME="0.0.0.0"
 
12
 
13
  CMD .venv/bin/python main.py
 
9
  COPY . .
10
 
11
  ENV GRADIO_SERVER_NAME="0.0.0.0"
12
+ ENV GRADIO_SERVER_PORT="8080"
13
 
14
  CMD .venv/bin/python main.py
docker-compose.yml CHANGED
@@ -2,7 +2,7 @@ services:
2
  web:
3
  build: .
4
  ports:
5
- - "8080:7860"
6
  environment:
7
  GEMINI_API_KEY: ${GEMINI_API_KEY}
8
 
 
2
  web:
3
  build: .
4
  ports:
5
+ - "8080:8080"
6
  environment:
7
  GEMINI_API_KEY: ${GEMINI_API_KEY}
8
 
main.py CHANGED
@@ -65,6 +65,9 @@ def get_mp3(text: str, voice: str, api_key: str = None) -> bytes:
65
 
66
  def generate_audio(file: bytes, openai_api_key: str) -> bytes:
67
 
 
 
 
68
  reader = PdfReader(io.BytesIO(file))
69
  text = "\n\n".join([page.extract_text() for page in reader.pages])
70
 
 
65
 
66
  def generate_audio(file: bytes, openai_api_key: str) -> bytes:
67
 
68
+ if not os.getenv("OPENAI_API_KEY", openai_api_key):
69
+ raise gr.Error("OpenAI API key is required")
70
+
71
  reader = PdfReader(io.BytesIO(file))
72
  text = "\n\n".join([page.extract_text() for page in reader.pages])
73