Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,25 @@ from sentence_transformers import SentenceTransformer
|
|
| 8 |
import chromadb
|
| 9 |
from chromadb.config import Settings
|
| 10 |
from llama_cpp import Llama
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# ---------------------- Data Loading & Cleaning ----------------------
|
| 13 |
|
|
|
|
| 8 |
import chromadb
|
| 9 |
from chromadb.config import Settings
|
| 10 |
from llama_cpp import Llama
|
| 11 |
+
import os
|
| 12 |
+
import requests
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# ---------------------- Downloading model ----------------------
|
| 17 |
+
|
| 18 |
+
MODEL_URL = "https://huggingface.co/datasets/psy7743/llama3-8b-instruct-Q8_0.gguf/resolve/main/llama3-8b-instruct-Q8_0.gguf"
|
| 19 |
+
MODEL_PATH = "llama3-8b-instruct-Q8_0.gguf"
|
| 20 |
+
|
| 21 |
+
if not Path(MODEL_PATH).exists():
|
| 22 |
+
print("📥 Downloading LLaMA model from Hugging Face Datasets...")
|
| 23 |
+
response = requests.get(MODEL_URL, stream=True)
|
| 24 |
+
with open(MODEL_PATH, "wb") as f:
|
| 25 |
+
for chunk in response.iter_content(chunk_size=8192):
|
| 26 |
+
if chunk:
|
| 27 |
+
f.write(chunk)
|
| 28 |
+
print("✅ Download complete!")
|
| 29 |
+
|
| 30 |
|
| 31 |
# ---------------------- Data Loading & Cleaning ----------------------
|
| 32 |
|