mothy-08 commited on
Commit ·
9e38dfa
1
Parent(s): ec98c33
Setup automatic deployment to Hugging Face
Browse files- .dockerignore +6 -0
- .github/workflows/deploy.yml +23 -0
- .gitignore +15 -0
- Dockerfile +21 -0
- api/config.py +1 -1
- chrome-extension/manifest.json +5 -1
- chrome-extension/sidepanel.js +1 -1
- requirements.txt +24 -0
.dockerignore
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__
|
| 2 |
+
venv
|
| 3 |
+
.env
|
| 4 |
+
.git
|
| 5 |
+
.gitignore
|
| 6 |
+
chrome-extension
|
.github/workflows/deploy.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face Hub
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
branches: [main]
|
| 5 |
+
|
| 6 |
+
jobs:
|
| 7 |
+
sync-to-hub:
|
| 8 |
+
runs-on: ubuntu-latest
|
| 9 |
+
steps:
|
| 10 |
+
- uses: actions/checkout@v3
|
| 11 |
+
with:
|
| 12 |
+
fetch-depth: 0
|
| 13 |
+
lfs: true
|
| 14 |
+
|
| 15 |
+
- name: Push to Hub
|
| 16 |
+
env:
|
| 17 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 18 |
+
HF_USERNAME: "mothy-08"
|
| 19 |
+
SPACE_NAME: "ragbot"
|
| 20 |
+
run: |
|
| 21 |
+
git config --global user.email "bot@github.com"
|
| 22 |
+
git config --global user.name "GitHub Actions"
|
| 23 |
+
git push --force https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main
|
.gitignore
CHANGED
|
@@ -205,3 +205,18 @@ cython_debug/
|
|
| 205 |
marimo/_static/
|
| 206 |
marimo/_lsp/
|
| 207 |
__marimo__/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
marimo/_static/
|
| 206 |
marimo/_lsp/
|
| 207 |
__marimo__/
|
| 208 |
+
|
| 209 |
+
# Mac System Files (If you or a collaborator uses Mac, these are annoying)
|
| 210 |
+
.DS_Store
|
| 211 |
+
|
| 212 |
+
# Vim / Neovim Swap and Session files
|
| 213 |
+
*.swp
|
| 214 |
+
*.swo
|
| 215 |
+
Session.vim
|
| 216 |
+
|
| 217 |
+
# Chrome Extension Builds (Don't commit the packed zip/crx)
|
| 218 |
+
*.crx
|
| 219 |
+
*.zip
|
| 220 |
+
|
| 221 |
+
# Docker (If you map local volumes or logs)
|
| 222 |
+
docker-compose.override.yml
|
Dockerfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
+
PYTHONUNBUFFERED=1
|
| 5 |
+
|
| 6 |
+
RUN useradd -m -u 1000 user
|
| 7 |
+
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 11 |
+
|
| 12 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 13 |
+
pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
|
| 14 |
+
|
| 15 |
+
COPY --chown=user ./api ./api
|
| 16 |
+
|
| 17 |
+
USER user
|
| 18 |
+
|
| 19 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 20 |
+
|
| 21 |
+
CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"]
|
api/config.py
CHANGED
|
@@ -26,7 +26,7 @@ def log_critical(api_key: str):
|
|
| 26 |
|
| 27 |
|
| 28 |
if not GOOGLE_API_KEY:
|
| 29 |
-
log_critical("
|
| 30 |
|
| 31 |
if not PINECONE_API_KEY:
|
| 32 |
log_critical("PINECONE_API_KEY")
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
if not GOOGLE_API_KEY:
|
| 29 |
+
log_critical("GOOGLE_API_KEY")
|
| 30 |
|
| 31 |
if not PINECONE_API_KEY:
|
| 32 |
log_critical("PINECONE_API_KEY")
|
chrome-extension/manifest.json
CHANGED
|
@@ -21,7 +21,11 @@
|
|
| 21 |
"128": "icons/icon128.png"
|
| 22 |
},
|
| 23 |
"permissions": ["activeTab", "scripting", "sidePanel"],
|
| 24 |
-
"host_permissions": [
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
"background": {
|
| 26 |
"service_worker": "background.js"
|
| 27 |
}
|
|
|
|
| 21 |
"128": "icons/icon128.png"
|
| 22 |
},
|
| 23 |
"permissions": ["activeTab", "scripting", "sidePanel"],
|
| 24 |
+
"host_permissions": [
|
| 25 |
+
"http://localhost:8000/*",
|
| 26 |
+
"https://mothy-08-ragbot.hf.space/*",
|
| 27 |
+
"<all_urls>"
|
| 28 |
+
],
|
| 29 |
"background": {
|
| 30 |
"service_worker": "background.js"
|
| 31 |
}
|
chrome-extension/sidepanel.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
// Config
|
| 2 |
-
const API_BASE = "
|
| 3 |
|
| 4 |
// DOM Elements
|
| 5 |
const views = {
|
|
|
|
| 1 |
// Config
|
| 2 |
+
const API_BASE = "https://mothy-08-ragbot.hf.space";
|
| 3 |
|
| 4 |
// DOM Elements
|
| 5 |
const views = {
|
requirements.txt
CHANGED
|
@@ -8,7 +8,10 @@ charset-normalizer==3.4.4
|
|
| 8 |
click==8.3.1
|
| 9 |
courlan==1.3.2
|
| 10 |
dateparser==1.2.2
|
|
|
|
| 11 |
fastapi==0.122.0
|
|
|
|
|
|
|
| 12 |
google-ai-generativelanguage==0.6.15
|
| 13 |
google-api-core==2.28.1
|
| 14 |
google-api-python-client==2.187.0
|
|
@@ -19,14 +22,23 @@ googleapis-common-protos==1.72.0
|
|
| 19 |
grpcio==1.76.0
|
| 20 |
grpcio-status==1.71.2
|
| 21 |
h11==0.16.0
|
|
|
|
| 22 |
htmldate==1.9.4
|
| 23 |
httplib2==0.31.0
|
|
|
|
| 24 |
idna==3.11
|
|
|
|
|
|
|
| 25 |
jusText==3.0.2
|
| 26 |
lxml==6.0.2
|
| 27 |
lxml_html_clean==0.4.3
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
orjson==3.11.4
|
| 29 |
packaging==24.2
|
|
|
|
| 30 |
pinecone==8.0.0
|
| 31 |
pinecone-plugin-assistant==3.0.1
|
| 32 |
pinecone-plugin-interface==0.0.7
|
|
@@ -38,16 +50,28 @@ pydantic==2.12.4
|
|
| 38 |
pydantic_core==2.41.5
|
| 39 |
pyparsing==3.2.5
|
| 40 |
python-dateutil==2.9.0.post0
|
|
|
|
| 41 |
pytz==2025.2
|
|
|
|
| 42 |
regex==2025.11.3
|
| 43 |
requests==2.32.5
|
| 44 |
rsa==4.9.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
six==1.17.0
|
| 46 |
sniffio==1.3.1
|
| 47 |
starlette==0.50.0
|
|
|
|
|
|
|
| 48 |
tld==0.13.1
|
|
|
|
|
|
|
| 49 |
tqdm==4.67.1
|
| 50 |
trafilatura==2.0.0
|
|
|
|
| 51 |
typing-inspection==0.4.2
|
| 52 |
typing_extensions==4.15.0
|
| 53 |
tzlocal==5.3.1
|
|
|
|
| 8 |
click==8.3.1
|
| 9 |
courlan==1.3.2
|
| 10 |
dateparser==1.2.2
|
| 11 |
+
dotenv==0.9.9
|
| 12 |
fastapi==0.122.0
|
| 13 |
+
filelock==3.20.0
|
| 14 |
+
fsspec==2025.10.0
|
| 15 |
google-ai-generativelanguage==0.6.15
|
| 16 |
google-api-core==2.28.1
|
| 17 |
google-api-python-client==2.187.0
|
|
|
|
| 22 |
grpcio==1.76.0
|
| 23 |
grpcio-status==1.71.2
|
| 24 |
h11==0.16.0
|
| 25 |
+
hf-xet==1.2.0
|
| 26 |
htmldate==1.9.4
|
| 27 |
httplib2==0.31.0
|
| 28 |
+
huggingface-hub==0.36.0
|
| 29 |
idna==3.11
|
| 30 |
+
Jinja2==3.1.6
|
| 31 |
+
joblib==1.5.2
|
| 32 |
jusText==3.0.2
|
| 33 |
lxml==6.0.2
|
| 34 |
lxml_html_clean==0.4.3
|
| 35 |
+
MarkupSafe==3.0.3
|
| 36 |
+
mpmath==1.3.0
|
| 37 |
+
networkx==3.6
|
| 38 |
+
numpy==2.3.5
|
| 39 |
orjson==3.11.4
|
| 40 |
packaging==24.2
|
| 41 |
+
pillow==12.0.0
|
| 42 |
pinecone==8.0.0
|
| 43 |
pinecone-plugin-assistant==3.0.1
|
| 44 |
pinecone-plugin-interface==0.0.7
|
|
|
|
| 50 |
pydantic_core==2.41.5
|
| 51 |
pyparsing==3.2.5
|
| 52 |
python-dateutil==2.9.0.post0
|
| 53 |
+
python-dotenv==1.2.1
|
| 54 |
pytz==2025.2
|
| 55 |
+
PyYAML==6.0.3
|
| 56 |
regex==2025.11.3
|
| 57 |
requests==2.32.5
|
| 58 |
rsa==4.9.1
|
| 59 |
+
safetensors==0.7.0
|
| 60 |
+
scikit-learn==1.7.2
|
| 61 |
+
scipy==1.16.3
|
| 62 |
+
sentence-transformers==5.1.2
|
| 63 |
+
setuptools==80.9.0
|
| 64 |
six==1.17.0
|
| 65 |
sniffio==1.3.1
|
| 66 |
starlette==0.50.0
|
| 67 |
+
sympy==1.14.0
|
| 68 |
+
threadpoolctl==3.6.0
|
| 69 |
tld==0.13.1
|
| 70 |
+
tokenizers==0.22.1
|
| 71 |
+
torch==2.9.1
|
| 72 |
tqdm==4.67.1
|
| 73 |
trafilatura==2.0.0
|
| 74 |
+
transformers==4.57.3
|
| 75 |
typing-inspection==0.4.2
|
| 76 |
typing_extensions==4.15.0
|
| 77 |
tzlocal==5.3.1
|