Spaces:
Paused
Paused
derek-thomas commited on
Commit ·
5d0067c
1
Parent(s): 94acd5b
Adding intro text
Browse files
app.py
CHANGED
|
@@ -76,9 +76,23 @@ def bot(history, hyde=False):
|
|
| 76 |
history[-1][1] = response.split('### Response: [|AI|]')[-1]
|
| 77 |
return history, prompt_html
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
with gr.Blocks() as demo:
|
| 81 |
-
|
|
|
|
| 82 |
with gr.Tab("Arabic-RAG"):
|
| 83 |
chatbot = gr.Chatbot(
|
| 84 |
[],
|
|
@@ -152,7 +166,5 @@ with gr.Blocks() as demo:
|
|
| 152 |
# Turn it back on
|
| 153 |
hyde_txt_msg.then(lambda: gr.Textbox(interactive=True), None, [hyde_txt], queue=False)
|
| 154 |
|
| 155 |
-
# Examples
|
| 156 |
-
|
| 157 |
demo.queue()
|
| 158 |
demo.launch(debug=True)
|
|
|
|
| 76 |
history[-1][1] = response.split('### Response: [|AI|]')[-1]
|
| 77 |
return history, prompt_html
|
| 78 |
|
| 79 |
+
intro_md = """
|
| 80 |
+
# Arabic RAG
|
| 81 |
+
This is a project to demonstrate Retreiver Augmented Generation (RAG) in Arabic and English. It uses
|
| 82 |
+
[Arabic Wikipedia](https://ar.wikipedia.org/wiki) as a base to answer questions you have.
|
| 83 |
+
A retriever ([sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2/discussions/8))
|
| 84 |
+
will find the articles relevant to your query and include them in a prompt so the reader ([core42/jais-13b-chat](https://huggingface.co/core42/jais-13b-chat))
|
| 85 |
+
can then answer your questions on it.
|
| 86 |
+
|
| 87 |
+
You can see the prompt clearly displayed below the chatbot to understand what is going to the LLM.
|
| 88 |
+
|
| 89 |
+
Note I'm using Inference Endpoint's Scale to Zero to save money on GPUs. If the staus shows its not "Running" send a
|
| 90 |
+
chat to wake it up. You will get a `500 error` and it will take ~7 min to wake up.
|
| 91 |
+
"""
|
| 92 |
|
| 93 |
with gr.Blocks() as demo:
|
| 94 |
+
gr.Markdown(intro_md)
|
| 95 |
+
endpoint_status = gr.Textbox(check_endpoint_status, label="Inference Endpoint Status", every=1)
|
| 96 |
with gr.Tab("Arabic-RAG"):
|
| 97 |
chatbot = gr.Chatbot(
|
| 98 |
[],
|
|
|
|
| 166 |
# Turn it back on
|
| 167 |
hyde_txt_msg.then(lambda: gr.Textbox(interactive=True), None, [hyde_txt], queue=False)
|
| 168 |
|
|
|
|
|
|
|
| 169 |
demo.queue()
|
| 170 |
demo.launch(debug=True)
|