SamDNX commited on
Commit
2383093
·
verified ·
1 Parent(s): 23c16f1

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +28 -0
  2. README.md +17 -5
  3. start.sh +10 -0
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ RUN apt-get update && apt-get install -y --no-install-recommends \
4
+ curl git ca-certificates zstd && rm -rf /var/lib/apt/lists/*
5
+
6
+ RUN curl -fsSL https://ollama.com/install.sh | sh
7
+
8
+ RUN useradd -m -u 1000 user
9
+ USER user
10
+ ENV HOME=/home/user \
11
+ PATH=/home/user/.local/bin:$PATH \
12
+ HOST=0.0.0.0 \
13
+ PORT=7860 \
14
+ OPEN_BROWSER=false \
15
+ OLLAMA_URL=http://localhost:11434 \
16
+ OLLAMA_MODEL=qwen2.5:0.5b \
17
+ OUTPUT_BASENAME=/tmp/papers
18
+
19
+ WORKDIR /home/user/app
20
+
21
+ RUN git clone --depth 1 https://github.com/RebornX10/rebornx10.github.io.git . \
22
+ && pip install --no-cache-dir --user -r requirements.txt
23
+
24
+ COPY --chown=user start.sh /home/user/start.sh
25
+
26
+ EXPOSE 7860
27
+
28
+ CMD ["bash", "/home/user/start.sh"]
README.md CHANGED
@@ -1,10 +1,22 @@
1
  ---
2
- title: Sci Paper Rag
3
- emoji: 🚀
4
- colorFrom: green
5
- colorTo: gray
6
  sdk: docker
 
7
  pinned: false
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: sci_paper_llm
3
+ emoji: 🔬
4
+ colorFrom: blue
5
+ colorTo: indigo
6
  sdk: docker
7
+ app_port: 7860
8
  pinned: false
9
+ license: mit
10
  ---
11
 
12
+ # sci_paper_llm live demo
13
+
14
+ Build open-access scientific-paper datasets from [OpenAlex](https://openalex.org) and
15
+ query them with a local LLM, running entirely inside this Space.
16
+
17
+ Source code: <https://github.com/RebornX10/rebornx10.github.io>
18
+
19
+ > **Free CPU Space caveats:** the LLM runs on CPU with a small model
20
+ > (`qwen2.5:0.5b` by default), so answers are slow and the model is pulled on
21
+ > cold start. For full speed, use a GPU Space or run locally with Docker Compose.
22
+ > Change the model with the `OLLAMA_MODEL` Space variable.
start.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # sci_paper_llm — Samuel Adone (GitHub: RebornX10) — MIT
3
+ set -e
4
+
5
+ ollama serve &
6
+ until curl -sf http://localhost:11434/api/tags >/dev/null 2>&1; do sleep 1; done
7
+ ollama pull "${OLLAMA_MODEL}"
8
+
9
+ cd /home/user/app
10
+ exec python main.py