Spaces:
Runtime error
Runtime error
Sébastien De Greef commited on
Commit ·
7ac7d6c
1
Parent(s): b002858
chore: Update Dockerfile to install CUDA 12.4.1 and cuDNN 9.1.1 libraries
Browse files- Dockerfile +2 -2
- src/main.py +18 -0
- src/static/index.html +12 -0
- start_chatbot.sh +1 -1
Dockerfile
CHANGED
|
@@ -30,10 +30,10 @@ RUN rm -f /etc/apt/sources.list.d/*.list && \
|
|
| 30 |
|
| 31 |
ENV PATH="/home/chatbot/.local/bin:${PATH}"
|
| 32 |
|
| 33 |
-
|
| 34 |
&& sudo sh cuda_12.4.1_550.54.15_linux.run
|
| 35 |
|
| 36 |
-
|
| 37 |
&& sudo dpkg -i cudnn-local-repo-ubuntu2204-9.1.1_1.0-1_amd64.deb \
|
| 38 |
&& sudo cp /var/cudnn-local-repo-ubuntu2204-9.1.1/cudnn-*-keyring.gpg /usr/share/keyrings/ \
|
| 39 |
&& sudo apt-get update && sudo apt-get -y install cudnn
|
|
|
|
| 30 |
|
| 31 |
ENV PATH="/home/chatbot/.local/bin:${PATH}"
|
| 32 |
|
| 33 |
+
RUN wget -q https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run \
|
| 34 |
&& sudo sh cuda_12.4.1_550.54.15_linux.run
|
| 35 |
|
| 36 |
+
RUN wget -q https://developer.download.nvidia.com/compute/cudnn/9.1.1/local_installers/cudnn-local-repo-ubuntu2204-9.1.1_1.0-1_amd64.deb \
|
| 37 |
&& sudo dpkg -i cudnn-local-repo-ubuntu2204-9.1.1_1.0-1_amd64.deb \
|
| 38 |
&& sudo cp /var/cudnn-local-repo-ubuntu2204-9.1.1/cudnn-*-keyring.gpg /usr/share/keyrings/ \
|
| 39 |
&& sudo apt-get update && sudo apt-get -y install cudnn
|
src/main.py
CHANGED
|
@@ -1 +1,19 @@
|
|
| 1 |
print("Started Bot...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
print("Started Bot...")
|
| 2 |
+
|
| 3 |
+
from fastapi import FastAPI
|
| 4 |
+
from fastapi.staticfiles import StaticFiles
|
| 5 |
+
from fastapi.responses import HTMLResponse
|
| 6 |
+
|
| 7 |
+
app = FastAPI()
|
| 8 |
+
|
| 9 |
+
# Mount the static directory
|
| 10 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 11 |
+
|
| 12 |
+
@app.get("/", response_class=HTMLResponse)
|
| 13 |
+
async def read_index():
|
| 14 |
+
with open("static/index.html") as f:
|
| 15 |
+
return f.read()
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
import uvicorn
|
| 19 |
+
uvicorn.run(app, host="0.0.0.0", port=7260)
|
src/static/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>FastAPI Static File</title>
|
| 7 |
+
</head>
|
| 8 |
+
<body>
|
| 9 |
+
<h1>Hello, FastAPI!</h1>
|
| 10 |
+
<p>This is a static HTML file served by FastAPI.</p>
|
| 11 |
+
</body>
|
| 12 |
+
</html>
|
start_chatbot.sh
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
echo "#### BOT BOOT ####"
|
| 2 |
-
|
|
|
|
| 1 |
echo "#### BOT BOOT ####"
|
| 2 |
+
cd src && uvicorn main:app
|