Context box dependable on KEEP env variables.
Browse files- app.py +15 -1
- vector3_db/chroma.sqlite3 +1 -1
app.py
CHANGED
|
@@ -95,6 +95,8 @@ doc_store = InMemoryDocumentStore().load_from_disk("pufendorfdocs.store")
|
|
| 95 |
print(f"Number of documents: {doc_store.count_documents()}.")
|
| 96 |
hybrid_retrieval = create_hybrid_retriever(doc_store)
|
| 97 |
|
|
|
|
|
|
|
| 98 |
|
| 99 |
# Contact OpenAI "moderator".
|
| 100 |
def moderator(message):
|
|
@@ -281,7 +283,7 @@ with gr.Blocks(theme=theme) as demo_blocks:
|
|
| 281 |
container=False,
|
| 282 |
)
|
| 283 |
with gr.Accordion("Retrieved context (latest answer)", open=False):
|
| 284 |
-
ctx_box = gr.Markdown(label="", show_label=False)
|
| 285 |
|
| 286 |
clear = gr.Button(
|
| 287 |
"Clear",
|
|
@@ -456,4 +458,16 @@ with gr.Blocks(theme=theme) as demo_blocks:
|
|
| 456 |
# demo.launch(share=True)
|
| 457 |
if __name__ == "__main__":
|
| 458 |
print("Starting")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
demo_blocks.launch()
|
|
|
|
| 95 |
print(f"Number of documents: {doc_store.count_documents()}.")
|
| 96 |
hybrid_retrieval = create_hybrid_retriever(doc_store)
|
| 97 |
|
| 98 |
+
show_ctxbox = True
|
| 99 |
+
|
| 100 |
|
| 101 |
# Contact OpenAI "moderator".
|
| 102 |
def moderator(message):
|
|
|
|
| 283 |
container=False,
|
| 284 |
)
|
| 285 |
with gr.Accordion("Retrieved context (latest answer)", open=False):
|
| 286 |
+
ctx_box = gr.Markdown(label="", show_label=False, visible=show_ctxbox)
|
| 287 |
|
| 288 |
clear = gr.Button(
|
| 289 |
"Clear",
|
|
|
|
| 458 |
# demo.launch(share=True)
|
| 459 |
if __name__ == "__main__":
|
| 460 |
print("Starting")
|
| 461 |
+
ctxkeep = os.getenv("CTXKEEP")
|
| 462 |
+
if not ctxkeep:
|
| 463 |
+
ctxkeep = 0
|
| 464 |
+
else:
|
| 465 |
+
ctxkeep = int(ctxkeep)
|
| 466 |
+
hybridkeep = os.getenv("HYBRIDKEEP")
|
| 467 |
+
if not hybridkeep:
|
| 468 |
+
hybridkeep = 0
|
| 469 |
+
else:
|
| 470 |
+
hybridkeep = int(hybridkeep)
|
| 471 |
+
if ctxkeep == 0 and hybridkeep == 0:
|
| 472 |
+
show_ctxbox = False
|
| 473 |
demo_blocks.launch()
|
vector3_db/chroma.sqlite3
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 11452416
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf34f8c213b724144ed01ca1a0d8220b7d9db55db5e238caae2e32e7a31a1fc8
|
| 3 |
size 11452416
|