Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -209,30 +209,22 @@ def clear_kb(user_id="demo"):
|
|
| 209 |
|
| 210 |
# ---- UI layout (feel free to tweak cosmetics) -----------------------------
|
| 211 |
with gr.Blocks() as demo:
|
| 212 |
-
gr.Markdown(
|
| 213 |
-
"### Tiny-RAG playground – 1) paste a passage → **Store** · "
|
| 214 |
-
"2) ask a question → **Answer**"
|
| 215 |
-
)
|
| 216 |
|
| 217 |
-
# ----
|
| 218 |
with gr.Row():
|
| 219 |
passage_box = gr.Textbox(lines=6, label="Reference passage")
|
| 220 |
user_id_box = gr.Textbox(value="demo", label="User ID")
|
| 221 |
-
|
| 222 |
-
# NEW chunking knobs
|
| 223 |
chunk_box = gr.Slider(128, 2048, value=DEFAULT_CHUNK_SIZE,
|
| 224 |
step=64, label="Chunk size (chars)")
|
| 225 |
overlap_box = gr.Slider(0, 1024, value=DEFAULT_CHUNK_OVERLAP,
|
| 226 |
step=32, label="Chunk overlap")
|
|
|
|
|
|
|
| 227 |
|
| 228 |
-
|
| 229 |
-
store_btn = gr.Button("Store passage")
|
| 230 |
-
clear_btn = gr.Button("Clear KB")
|
| 231 |
-
|
| 232 |
-
# status line (defined before we wire handlers)
|
| 233 |
-
status_box = gr.Markdown()
|
| 234 |
|
| 235 |
-
#
|
| 236 |
store_btn.click(
|
| 237 |
fn=store_doc,
|
| 238 |
inputs=[passage_box, user_id_box, chunk_box, overlap_box],
|
|
|
|
| 209 |
|
| 210 |
# ---- UI layout (feel free to tweak cosmetics) -----------------------------
|
| 211 |
with gr.Blocks() as demo:
|
| 212 |
+
gr.Markdown("### Tiny-RAG playground …")
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
+
# ---- passage ingestion ----
|
| 215 |
with gr.Row():
|
| 216 |
passage_box = gr.Textbox(lines=6, label="Reference passage")
|
| 217 |
user_id_box = gr.Textbox(value="demo", label="User ID")
|
|
|
|
|
|
|
| 218 |
chunk_box = gr.Slider(128, 2048, value=DEFAULT_CHUNK_SIZE,
|
| 219 |
step=64, label="Chunk size (chars)")
|
| 220 |
overlap_box = gr.Slider(0, 1024, value=DEFAULT_CHUNK_OVERLAP,
|
| 221 |
step=32, label="Chunk overlap")
|
| 222 |
+
store_btn = gr.Button("Store passage")
|
| 223 |
+
clear_btn = gr.Button("Clear KB")
|
| 224 |
|
| 225 |
+
status_box = gr.Markdown() # declare *before* wiring handlers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
+
# ---- wire handlers (each button exactly once) ----
|
| 228 |
store_btn.click(
|
| 229 |
fn=store_doc,
|
| 230 |
inputs=[passage_box, user_id_box, chunk_box, overlap_box],
|