Spaces:
Sleeping
Sleeping
Aleksandr Maiorov
commited on
Commit
·
f19d93a
1
Parent(s):
1b071a4
v0.2.0
Browse files- откат 3
- Dockerfile +6 -11
- app.py +9 -0
Dockerfile
CHANGED
@@ -1,22 +1,17 @@
|
|
1 |
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
# you will also find guides on how best to write your Dockerfile
|
3 |
-
FROM ghcr.io/ggerganov/llama.cpp:server
|
4 |
-
ENV LLAMA_ARG_MODEL_URL=https://huggingface.co/Vikhrmodels/Vikhr-Qwen-2.5-1.5B-Instruct-GGUF/resolve/main/Vikhr-Qwen-2.5-1.5b-Instruct-Q8_0.gguf \
|
5 |
-
LLAMA_ARG_CTX_SIZE=4096 \
|
6 |
-
LLAMA_ARG_N_PARALLEL=2 \
|
7 |
-
LLAMA_ARG_ENDPOINT_METRICS=1 \
|
8 |
-
LLAMA_ARG_PORT=8080
|
9 |
-
RUN ./llama-server --host 0.0.0.0
|
10 |
|
11 |
-
|
12 |
-
|
13 |
RUN useradd -m -u 1000 user
|
14 |
USER user
|
15 |
ENV PATH="/home/user/.local/bin:$PATH"
|
16 |
|
|
|
|
|
17 |
COPY --chown=user ./requirements.txt requirements.txt
|
18 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
19 |
|
20 |
COPY --chown=user . /app
|
21 |
-
|
22 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
# you will also find guides on how best to write your Dockerfile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
FROM python:3.9
|
5 |
+
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
9 |
|
10 |
+
WORKDIR /app
|
11 |
+
|
12 |
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
+
RUN pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
15 |
|
16 |
COPY --chown=user . /app
|
17 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
app.py
CHANGED
@@ -113,3 +113,12 @@ async def predict(text: str):
|
|
113 |
prompt = create_prompt(text)
|
114 |
response = generate_response(prompt)
|
115 |
return {"response": response}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
prompt = create_prompt(text)
|
114 |
response = generate_response(prompt)
|
115 |
return {"response": response}
|
116 |
+
|
117 |
+
@app.post("/webhook")
|
118 |
+
async def predict(response):
|
119 |
+
# Генерация ответа с помощью модели
|
120 |
+
logger.info('post/webhook -> response:')
|
121 |
+
logger.info(response)
|
122 |
+
# prompt = create_prompt(text)
|
123 |
+
# response = generate_response(prompt)
|
124 |
+
return {"response": response}
|