Spaces:
Build error
Build error
Commit
·
44cb5e2
1
Parent(s):
7370d18
Update run.py
Browse files
run.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
# Title: Gradio Interface to LLM-chatbot with RAG-funcionality and ChromaDB on premises
|
| 3 |
# Author: Andreas Fischer
|
| 4 |
# Date: October 15th, 2023
|
| 5 |
-
# Last update: December
|
| 6 |
##########################################################################################
|
| 7 |
|
| 8 |
|
|
@@ -93,7 +93,7 @@ def response(message, history):
|
|
| 93 |
#where={"source": "google-docs"}
|
| 94 |
#where_document={"$contains":"search_string"}
|
| 95 |
)
|
| 96 |
-
dists=["<small>(relevance: "+str(round((1-d)*100/100)
|
| 97 |
sources=["source: "+s["source"]+")</small>" for s in results['metadatas'][0]]
|
| 98 |
results=results['documents'][0]
|
| 99 |
combination = zip(results,dists,sources)
|
|
@@ -136,5 +136,5 @@ def response(message, history):
|
|
| 136 |
yield response
|
| 137 |
yield response+"\n\n<br><details open><summary><strong>Sources</strong></summary><br><ul>"+ "".join(["<li>" + s + "</li>" for s in combination])+"</ul></details>"
|
| 138 |
|
| 139 |
-
gr.ChatInterface(response, chatbot=gr.Chatbot(render_markdown=True),title="RAG-Interface").queue().launch(share=True) #False, server_name="0.0.0.0", server_port=7864)
|
| 140 |
print("Interface up and running!")
|
|
|
|
| 2 |
# Title: Gradio Interface to LLM-chatbot with RAG-funcionality and ChromaDB on premises
|
| 3 |
# Author: Andreas Fischer
|
| 4 |
# Date: October 15th, 2023
|
| 5 |
+
# Last update: December 30th, 2023
|
| 6 |
##########################################################################################
|
| 7 |
|
| 8 |
|
|
|
|
| 93 |
#where={"source": "google-docs"}
|
| 94 |
#where_document={"$contains":"search_string"}
|
| 95 |
)
|
| 96 |
+
dists=["<small>(relevance: "+str(round((1-d)*100)/100)+";" for d in results['distances'][0]]
|
| 97 |
sources=["source: "+s["source"]+")</small>" for s in results['metadatas'][0]]
|
| 98 |
results=results['documents'][0]
|
| 99 |
combination = zip(results,dists,sources)
|
|
|
|
| 136 |
yield response
|
| 137 |
yield response+"\n\n<br><details open><summary><strong>Sources</strong></summary><br><ul>"+ "".join(["<li>" + s + "</li>" for s in combination])+"</ul></details>"
|
| 138 |
|
| 139 |
+
gr.ChatInterface(response, chatbot=gr.Chatbot(render_markdown=True),title="RAG-Interface to Mistral-7B-Instruct-v0.2-GGUF").queue().launch(share=True) #False, server_name="0.0.0.0", server_port=7864)
|
| 140 |
print("Interface up and running!")
|