Hawoly
commited on
Commit
·
4ff0f4c
1
Parent(s):
90d64ef
Initial commit
Browse files- Dockerfile +14 -0
- app.py +17 -0
- requirements.txt +15 -0
Dockerfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
RUN useradd user
|
| 4 |
+
USER user
|
| 5 |
+
ENV HOME=/home/user \
|
| 6 |
+
PATH=/home/user/.local/bin:$PATH
|
| 7 |
+
|
| 8 |
+
WORKDIR $HOME/app
|
| 9 |
+
|
| 10 |
+
COPY --chown=user ./ $HOME/app
|
| 11 |
+
|
| 12 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
+
|
| 14 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Use the text-generation pipeline
|
| 5 |
+
pipe = pipeline("text-generation", model="Hawoly18/Adia_Llama3.1")
|
| 6 |
+
|
| 7 |
+
app = FastAPI()
|
| 8 |
+
|
| 9 |
+
@app.get('/')
|
| 10 |
+
def home():
|
| 11 |
+
return {"hello": "Concree"}
|
| 12 |
+
|
| 13 |
+
@app.get('/generate')
|
| 14 |
+
def generate(text: str):
|
| 15 |
+
# Generate text using the pipeline
|
| 16 |
+
result = pipe(text)
|
| 17 |
+
return {"result": result[0]['generated_text']}
|
requirements.txt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi
|
| 2 |
+
uvicorn
|
| 3 |
+
transformers
|
| 4 |
+
torch
|
| 5 |
+
jax
|
| 6 |
+
jaxlib
|
| 7 |
+
git+https://github.com/huggingface/transformers.git
|
| 8 |
+
accelerate
|
| 9 |
+
sentencepiece
|
| 10 |
+
xformers
|
| 11 |
+
trl<0.9.0
|
| 12 |
+
peft
|
| 13 |
+
bitsandbytes
|
| 14 |
+
requests==2.27.*
|
| 15 |
+
uvicorn[standard]==0.17.*
|