Spaces:
Running
Running
Rachit-Mangawa commited on
Commit ·
7580459
1
Parent(s): 801d089
feat: Upgrade to Llama 3.2 (3B) for superior autonomous reasoning
Browse files- Dockerfile +2 -2
- app.py +4 -4
Dockerfile
CHANGED
|
@@ -17,8 +17,8 @@ ENV PORT=8086
|
|
| 17 |
ENV OLLAMA_HOST=127.0.0.1:11434
|
| 18 |
ENV PYTHONUNBUFFERED=1
|
| 19 |
|
| 20 |
-
# Execution Script: Starts Ollama, pulls
|
| 21 |
-
RUN echo '#!/bin/bash\nollama serve & sleep 10 && ollama pull
|
| 22 |
chmod +x /app/run.sh
|
| 23 |
|
| 24 |
EXPOSE 8086
|
|
|
|
| 17 |
ENV OLLAMA_HOST=127.0.0.1:11434
|
| 18 |
ENV PYTHONUNBUFFERED=1
|
| 19 |
|
| 20 |
+
# Execution Script: Starts Ollama, pulls Llama 3.2 (3B - Optimal for CPU), starts App
|
| 21 |
+
RUN echo '#!/bin/bash\nollama serve & sleep 10 && ollama pull llama3.2 && python app.py' > /app/run.sh && \
|
| 22 |
chmod +x /app/run.sh
|
| 23 |
|
| 24 |
EXPOSE 8086
|
app.py
CHANGED
|
@@ -43,9 +43,9 @@ PRIORITY_MAP = {
|
|
| 43 |
|
| 44 |
async def call_llm_local(prompt: str, system: str = "") -> Optional[Dict]:
|
| 45 |
async with llm_semaphore_local:
|
| 46 |
-
logger.info("Local Inference:
|
| 47 |
payload = {
|
| 48 |
-
"model": "
|
| 49 |
"prompt": f"System: {system}\nStrict Grounding. No Fabrication. Context: {prompt}\nUser: Return JSON message.",
|
| 50 |
"stream": False,
|
| 51 |
"format": "json",
|
|
@@ -143,9 +143,9 @@ async def healthz():
|
|
| 143 |
async with httpx.AsyncClient() as client:
|
| 144 |
try:
|
| 145 |
res = await client.get("http://127.0.0.1:11434/api/tags")
|
| 146 |
-
if "
|
| 147 |
except: pass
|
| 148 |
-
return {"status": "starting", "message": "Ollama/
|
| 149 |
|
| 150 |
@app.post("/v1/context")
|
| 151 |
def push_context(data: ContextPayload):
|
|
|
|
| 43 |
|
| 44 |
async def call_llm_local(prompt: str, system: str = "") -> Optional[Dict]:
|
| 45 |
async with llm_semaphore_local:
|
| 46 |
+
logger.info("Local Inference: Llama 3.2 (3B)")
|
| 47 |
payload = {
|
| 48 |
+
"model": "llama3.2",
|
| 49 |
"prompt": f"System: {system}\nStrict Grounding. No Fabrication. Context: {prompt}\nUser: Return JSON message.",
|
| 50 |
"stream": False,
|
| 51 |
"format": "json",
|
|
|
|
| 143 |
async with httpx.AsyncClient() as client:
|
| 144 |
try:
|
| 145 |
res = await client.get("http://127.0.0.1:11434/api/tags")
|
| 146 |
+
if "llama3.2" in res.text: return {"status": "ok", "local_model": "ready"}
|
| 147 |
except: pass
|
| 148 |
+
return {"status": "starting", "message": "Ollama/Llama3.2 warming up"}
|
| 149 |
|
| 150 |
@app.post("/v1/context")
|
| 151 |
def push_context(data: ContextPayload):
|