Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ model_path = hf_hub_download(
|
|
| 39 |
|
| 40 |
llm = Llama(
|
| 41 |
model_path=model_path,
|
| 42 |
-
n_ctx=
|
| 43 |
n_threads=2,
|
| 44 |
n_batch=512,
|
| 45 |
n_ubatch=512,
|
|
@@ -77,6 +77,7 @@ def get_vectorstore(backend_name: str):
|
|
| 77 |
SYSTEM_PROMPT = """You are the reference expert for the articles contained in the training of this model, all extracted from the website robertolofaro.com, and all focused on change.
|
| 78 |
#Your Mission:
|
| 79 |
When a user asks a question, your goal is to provide a structured response based ONLY on the articles provided in your training. Do not provide general advice from outside these sources.
|
|
|
|
| 80 |
# Response Format:
|
| 81 |
1. Executive Summary: A 2-3 sentence overview answering the core query.
|
| 82 |
2. Guidelines & Hints: A markdown list of specific "answers/guidelines/hints" found in the source material.
|
|
@@ -135,7 +136,21 @@ def generate_response(message, history, rag_mode, article_filter, max_tokens, te
|
|
| 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(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
with gr.Row():
|
| 141 |
rag_mode = gr.Radio(
|
|
|
|
| 39 |
|
| 40 |
llm = Llama(
|
| 41 |
model_path=model_path,
|
| 42 |
+
n_ctx=8192,
|
| 43 |
n_threads=2,
|
| 44 |
n_batch=512,
|
| 45 |
n_ubatch=512,
|
|
|
|
| 77 |
SYSTEM_PROMPT = """You are the reference expert for the articles contained in the training of this model, all extracted from the website robertolofaro.com, and all focused on change.
|
| 78 |
#Your Mission:
|
| 79 |
When a user asks a question, your goal is to provide a structured response based ONLY on the articles provided in your training. Do not provide general advice from outside these sources.
|
| 80 |
+
If you provide references to specific articles in your training, give both the article_number and article_title.
|
| 81 |
# Response Format:
|
| 82 |
1. Executive Summary: A 2-3 sentence overview answering the core query.
|
| 83 |
2. Guidelines & Hints: A markdown list of specific "answers/guidelines/hints" found in the source material.
|
|
|
|
| 136 |
# ====================== GRADIO INTERFACE ======================
|
| 137 |
with gr.Blocks(title="Article Q&A model") as demo:
|
| 138 |
gr.Markdown("# sourcing 350+ articles on change")
|
| 139 |
+
gr.Markdown(
|
| 140 |
+
"Qwen3.5-4B DoRA fine-tuned on 350+ articles on change from robertolofaro.com — "
|
| 141 |
+
"experimental on CPU-only, to test embedding methods (takes a few minutes, "
|
| 142 |
+
"no selection for the category yet) — updated as of 2026-05-05"
|
| 143 |
+
)
|
| 144 |
+
gr.Markdown(f"**Runtime:** {STATUS_LINE}")
|
| 145 |
+
gr.Markdown(
|
| 146 |
+
"**NOTAM:** by querying this model you access the articles and metadata "
|
| 147 |
+
"available on robertolofaro.com and GitHub. "
|
| 148 |
+
"Answers reflect the article corpus only — do not treat them as advice- just expression of a position contained within the articles."
|
| 149 |
+
)
|
| 150 |
+
gr.Markdown(
|
| 151 |
+
"If, after getting an answer, you want something tailored to your context, "
|
| 152 |
+
"contact a consultant (myself included)."
|
| 153 |
+
)
|
| 154 |
|
| 155 |
with gr.Row():
|
| 156 |
rag_mode = gr.Radio(
|