robertolofaro commited on
Commit
b9f2f8c
·
verified ·
1 Parent(s): 09af320

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -9,12 +9,10 @@ from langchain_huggingface import HuggingFaceEmbeddings
9
  repo_id = "robertolofaro/articles-model"
10
 
11
  BACKENDS = {
12
- "Chroma - RAG": "Chroma",
13
  "FAISS - RAG (HNSW)": "FAISS",
14
  "Qdrant - RAG": "Qdrant"
15
  }
16
 
17
- CHROMA_PATH = "chroma_db"
18
  FAISS_PATH = "faiss_index_hnsw"
19
  QDRANT_PATH = "qdrant_db"
20
  QDRANT_COLLECTION = "articles"
@@ -59,10 +57,7 @@ def get_vectorstore(backend_name: str):
59
  try:
60
  embeddings = HuggingFaceEmbeddings(model_name="BAAI/bge-small-en-v1.5", encode_kwargs={'normalize_embeddings': True})
61
 
62
- if backend_name == "Chroma":
63
- from langchain_community.vectorstores import Chroma
64
- vs = Chroma(persist_directory=CHROMA_PATH, embedding_function=embeddings)
65
- elif backend_name == "FAISS":
66
  from langchain_community.vectorstores import FAISS
67
  vs = FAISS.load_local(FAISS_PATH, embeddings, allow_dangerous_deserialization=True)
68
  elif backend_name == "Qdrant":
@@ -140,7 +135,7 @@ def generate_response(message, history, rag_mode, article_filter, max_tokens, te
140
  # ====================== GRADIO INTERFACE ======================
141
  with gr.Blocks(title="Article Q&A model") as demo:
142
  gr.Markdown("# sourcing 350+ articles on change")
143
- gr.Markdown("Qwen3.5-4B DoRA fine-tuned on 350+ articles on change from robertolofaro.com - experimental on CPU-only, to test embedding methods (takes few minutes, no selection for the category yet)")
144
 
145
  with gr.Row():
146
  rag_mode = gr.Radio(
 
9
  repo_id = "robertolofaro/articles-model"
10
 
11
  BACKENDS = {
 
12
  "FAISS - RAG (HNSW)": "FAISS",
13
  "Qdrant - RAG": "Qdrant"
14
  }
15
 
 
16
  FAISS_PATH = "faiss_index_hnsw"
17
  QDRANT_PATH = "qdrant_db"
18
  QDRANT_COLLECTION = "articles"
 
57
  try:
58
  embeddings = HuggingFaceEmbeddings(model_name="BAAI/bge-small-en-v1.5", encode_kwargs={'normalize_embeddings': True})
59
 
60
+ if backend_name == "FAISS":
 
 
 
61
  from langchain_community.vectorstores import FAISS
62
  vs = FAISS.load_local(FAISS_PATH, embeddings, allow_dangerous_deserialization=True)
63
  elif backend_name == "Qdrant":
 
135
  # ====================== GRADIO INTERFACE ======================
136
  with gr.Blocks(title="Article Q&A model") as demo:
137
  gr.Markdown("# sourcing 350+ articles on change")
138
+ gr.Markdown("Qwen3.5-4B DoRA fine-tuned on 350+ articles on change from robertolofaro.com - experimental on CPU-only, to test embedding methods (takes few minutes, no selection for the category yet) - updated as of 2026-05-05")
139
 
140
  with gr.Row():
141
  rag_mode = gr.Radio(