Spaces:
Build error
Build error
Initial commit
Browse files- .gitignore +2 -0
- Dockerfile +40 -0
- README.md +1 -0
- palmyra-fin-chat/README.md +3 -0
- palmyra-fin-chat/main.py +20 -0
- palmyra-fin-chat/static/README.md +8 -0
- palmyra-fin-chat/static/favicon.png +0 -0
- palmyra-fin-chat/ui.json +94 -0
- pyproject.toml +15 -0
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.DS_STORE
|
| 2 |
+
__pycache__
|
Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim-buster AS Build
|
| 2 |
+
|
| 3 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 4 |
+
PIP_NO_CACHE_DIR=1 \
|
| 5 |
+
POETRY_NO_INTERACTION=1 \
|
| 6 |
+
POETRY_VIRTUALENVS_CREATE=false \
|
| 7 |
+
POETRY_VERSION=1.7.1
|
| 8 |
+
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
COPY ./pyproject.toml /app/
|
| 12 |
+
|
| 13 |
+
RUN apt-get update && \
|
| 14 |
+
apt-get install -y gcc g++ unixodbc-dev && \
|
| 15 |
+
pip install "poetry==$POETRY_VERSION" && \
|
| 16 |
+
poetry export --without-hashes --format requirements.txt --output requirements.txt && \
|
| 17 |
+
python3 -m pip wheel --no-cache-dir --no-deps -w /app/wheels -r requirements.txt
|
| 18 |
+
|
| 19 |
+
FROM python:3.11-slim-buster AS Run
|
| 20 |
+
|
| 21 |
+
ENV HOME=/home/user \
|
| 22 |
+
PATH=/home/user/.local/bin:$PATH
|
| 23 |
+
|
| 24 |
+
RUN useradd -m -u 1000 user
|
| 25 |
+
|
| 26 |
+
USER user
|
| 27 |
+
|
| 28 |
+
COPY --from=build /app/wheels $HOME/app/wheels
|
| 29 |
+
|
| 30 |
+
WORKDIR $HOME/app/wheels
|
| 31 |
+
|
| 32 |
+
RUN pip3 --no-cache-dir install *.whl
|
| 33 |
+
|
| 34 |
+
COPY --chown=user ./palmyra-fin-chat $HOME/app
|
| 35 |
+
|
| 36 |
+
WORKDIR $HOME/app
|
| 37 |
+
|
| 38 |
+
ENTRYPOINT [ "writer", "run" ]
|
| 39 |
+
EXPOSE 8080
|
| 40 |
+
CMD [ ".", "--port", "8080", "--host", "0.0.0.0" ]
|
README.md
CHANGED
|
@@ -5,6 +5,7 @@ colorFrom: gray
|
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
+
app_port: 8080
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
palmyra-fin-chat/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This app was created using Writer Framework.
|
| 2 |
+
|
| 3 |
+
To learn more about it, visit https://dev.writer.com/framework
|
palmyra-fin-chat/main.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import writer as wf
|
| 2 |
+
import writer.ai
|
| 3 |
+
|
| 4 |
+
# Welcome to Writer Framework!
|
| 5 |
+
# This template is a starting point for your AI apps.
|
| 6 |
+
# More documentation is available at https://dev.writer.com/framework
|
| 7 |
+
def handle_simple_message(state, payload):
|
| 8 |
+
state["conversation"] += payload
|
| 9 |
+
|
| 10 |
+
for chunk in state["conversation"].stream_complete():
|
| 11 |
+
state["conversation"] += chunk
|
| 12 |
+
|
| 13 |
+
# Initialise the state
|
| 14 |
+
wf.init_state({
|
| 15 |
+
"my_app": {
|
| 16 |
+
"title": "Palmyra-Fin Chat"
|
| 17 |
+
},
|
| 18 |
+
"conversation": writer.ai.Conversation(config={"model": "palmyra-fin-32k"}),
|
| 19 |
+
"footer": "Made with ❤️ with [Writer Framework](https://www.github.com/writer/writer-framework)"
|
| 20 |
+
})
|
palmyra-fin-chat/static/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Serving static files
|
| 2 |
+
|
| 3 |
+
You can use this folder to store files which will be served statically in the "/static" route.
|
| 4 |
+
|
| 5 |
+
This is useful to store images and other files which will be served directly to the user of your application.
|
| 6 |
+
|
| 7 |
+
For example, if you store an image named "myimage.jpg" in this folder, it'll be accessible as "static/myimage.jpg".
|
| 8 |
+
You can use this relative route as the source in an Image component.
|
palmyra-fin-chat/static/favicon.png
ADDED
|
|
palmyra-fin-chat/ui.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"writer_version": "0.7.0rc2"
|
| 4 |
+
},
|
| 5 |
+
"components": {
|
| 6 |
+
"root": {
|
| 7 |
+
"id": "root",
|
| 8 |
+
"type": "root",
|
| 9 |
+
"content": {
|
| 10 |
+
"appName": "Palmyra-Fin Chat"
|
| 11 |
+
},
|
| 12 |
+
"isCodeManaged": false,
|
| 13 |
+
"position": 0,
|
| 14 |
+
"handlers": {},
|
| 15 |
+
"visible": true
|
| 16 |
+
},
|
| 17 |
+
"c0f99a9e-5004-4e75-a6c6-36f17490b134": {
|
| 18 |
+
"id": "c0f99a9e-5004-4e75-a6c6-36f17490b134",
|
| 19 |
+
"type": "page",
|
| 20 |
+
"content": {
|
| 21 |
+
"pageMode": "compact"
|
| 22 |
+
},
|
| 23 |
+
"isCodeManaged": false,
|
| 24 |
+
"position": 0,
|
| 25 |
+
"parentId": "root",
|
| 26 |
+
"handlers": {},
|
| 27 |
+
"visible": true
|
| 28 |
+
},
|
| 29 |
+
"bebc5fe9-63a7-46a7-b0fa-62303555cfaf": {
|
| 30 |
+
"id": "bebc5fe9-63a7-46a7-b0fa-62303555cfaf",
|
| 31 |
+
"type": "header",
|
| 32 |
+
"content": {
|
| 33 |
+
"text": "@{my_app.title}"
|
| 34 |
+
},
|
| 35 |
+
"isCodeManaged": false,
|
| 36 |
+
"position": 0,
|
| 37 |
+
"parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134",
|
| 38 |
+
"handlers": {},
|
| 39 |
+
"visible": true
|
| 40 |
+
},
|
| 41 |
+
"ejpasds0o8qyjs1n": {
|
| 42 |
+
"id": "ejpasds0o8qyjs1n",
|
| 43 |
+
"type": "section",
|
| 44 |
+
"content": {
|
| 45 |
+
"title": ""
|
| 46 |
+
},
|
| 47 |
+
"isCodeManaged": false,
|
| 48 |
+
"position": 1,
|
| 49 |
+
"parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134",
|
| 50 |
+
"handlers": {},
|
| 51 |
+
"visible": true
|
| 52 |
+
},
|
| 53 |
+
"y7k0mr8temjlxs8d": {
|
| 54 |
+
"id": "y7k0mr8temjlxs8d",
|
| 55 |
+
"type": "chatbot",
|
| 56 |
+
"content": {
|
| 57 |
+
"conversation": "@{conversation}"
|
| 58 |
+
},
|
| 59 |
+
"isCodeManaged": false,
|
| 60 |
+
"position": 0,
|
| 61 |
+
"parentId": "ejpasds0o8qyjs1n",
|
| 62 |
+
"handlers": {
|
| 63 |
+
"wf-chatbot-message": "handle_simple_message"
|
| 64 |
+
},
|
| 65 |
+
"visible": true
|
| 66 |
+
},
|
| 67 |
+
"qsq3tf89p9t5p0k0": {
|
| 68 |
+
"id": "qsq3tf89p9t5p0k0",
|
| 69 |
+
"type": "section",
|
| 70 |
+
"content": {
|
| 71 |
+
"title": ""
|
| 72 |
+
},
|
| 73 |
+
"isCodeManaged": false,
|
| 74 |
+
"position": 1,
|
| 75 |
+
"parentId": "ejpasds0o8qyjs1n",
|
| 76 |
+
"handlers": {},
|
| 77 |
+
"visible": true
|
| 78 |
+
},
|
| 79 |
+
"lxhgu1c22bfiuaol": {
|
| 80 |
+
"id": "lxhgu1c22bfiuaol",
|
| 81 |
+
"type": "text",
|
| 82 |
+
"content": {
|
| 83 |
+
"text": "@{footer}",
|
| 84 |
+
"useMarkdown": "yes",
|
| 85 |
+
"alignment": "center"
|
| 86 |
+
},
|
| 87 |
+
"isCodeManaged": false,
|
| 88 |
+
"position": 0,
|
| 89 |
+
"parentId": "qsq3tf89p9t5p0k0",
|
| 90 |
+
"handlers": {},
|
| 91 |
+
"visible": true
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
}
|
pyproject.toml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[tool.poetry]
|
| 2 |
+
name = "writer-framework-default"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = ""
|
| 5 |
+
authors = ["Your Name <[email protected]>"]
|
| 6 |
+
readme = "README.md"
|
| 7 |
+
|
| 8 |
+
[tool.poetry.dependencies]
|
| 9 |
+
python = "^3.10.0"
|
| 10 |
+
writer = {version = "^0.6.0"}
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
[build-system]
|
| 14 |
+
requires = ["poetry-core"]
|
| 15 |
+
build-backend = "poetry.core.masonry.api"
|