grimjim commited on
Commit
4264b6a
·
1 Parent(s): b67d9fc
Files changed (3) hide show
  1. Dockerfile +1 -0
  2. app.py +21 -5
  3. requirements.txt +1 -0
Dockerfile CHANGED
@@ -6,6 +6,7 @@ ENV PYTHONUNBUFFERED=1 \
6
  GRADIO_NUM_PORTS=1 \
7
  GRADIO_SERVER_NAME=0.0.0.0 \
8
  GRADIO_SERVER_PORT=7860 \
 
9
  PIP_NO_CACHE_DIR=1
10
 
11
  RUN apt-get update && \
 
6
  GRADIO_NUM_PORTS=1 \
7
  GRADIO_SERVER_NAME=0.0.0.0 \
8
  GRADIO_SERVER_PORT=7860 \
9
+ GRADIO_THEME=huggingface \
10
  PIP_NO_CACHE_DIR=1
11
 
12
  RUN apt-get update && \
app.py CHANGED
@@ -3,6 +3,8 @@ from functools import lru_cache
3
  from typing import Any
4
 
5
  import gradio as gr
 
 
6
  from huggingface_hub import hf_hub_download
7
  from llama_cpp import Llama
8
 
@@ -194,10 +196,24 @@ with gr.Blocks() as demo:
194
  clear.click(clear_chat, outputs=[chat, message], show_api=False)
195
 
196
 
 
 
 
 
 
 
 
 
 
 
 
197
  if __name__ == "__main__":
198
- demo.queue(max_size=8).launch(
199
- server_name="0.0.0.0",
200
- server_port=7860,
201
- debug=True,
202
- show_api=False,
 
 
 
203
  )
 
3
  from typing import Any
4
 
5
  import gradio as gr
6
+ from fastapi import FastAPI
7
+ from fastapi.responses import HTMLResponse
8
  from huggingface_hub import hf_hub_download
9
  from llama_cpp import Llama
10
 
 
196
  clear.click(clear_chat, outputs=[chat, message], show_api=False)
197
 
198
 
199
+ app = FastAPI()
200
+
201
+
202
+ @app.get("/healthz", response_class=HTMLResponse)
203
+ def healthz() -> str:
204
+ return "<h1>Dreadzone health check OK</h1>"
205
+
206
+
207
+ app = gr.mount_gradio_app(app, demo, path="/")
208
+
209
+
210
  if __name__ == "__main__":
211
+ gr.close_all()
212
+ import uvicorn
213
+
214
+ uvicorn.run(
215
+ app,
216
+ host="0.0.0.0",
217
+ port=7860,
218
+ log_level="debug",
219
  )
requirements.txt CHANGED
@@ -3,3 +3,4 @@
3
  gradio==5.49.1
4
  huggingface_hub>=0.23.0
5
  llama-cpp-python==0.3.29
 
 
3
  gradio==5.49.1
4
  huggingface_hub>=0.23.0
5
  llama-cpp-python==0.3.29
6
+ uvicorn[standard]>=0.30.0