Spaces:
Paused
Paused
derek-thomas commited on
Commit ·
e093898
1
Parent(s): 9633962
Removing HyDE for now
Browse files
app.py
CHANGED
|
@@ -90,8 +90,10 @@ A retriever ([sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2](https
|
|
| 90 |
You can see the prompt clearly displayed below the chatbot to understand what is going to the LLM.
|
| 91 |
|
| 92 |
# Read this if you get an error
|
| 93 |
-
I'm using Inference Endpoint's
|
| 94 |
-
|
|
|
|
|
|
|
| 95 |
"""
|
| 96 |
|
| 97 |
|
|
@@ -104,10 +106,8 @@ def process_example(text, history=[]):
|
|
| 104 |
|
| 105 |
with gr.Blocks() as demo:
|
| 106 |
gr.Markdown(intro_md)
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
with gr.Column(scale=1):
|
| 110 |
-
wakeup_endpoint = gr.Button('Click to Wake Up Endpoint')
|
| 111 |
with gr.Tab("Arabic-RAG"):
|
| 112 |
chatbot = gr.Chatbot(
|
| 113 |
[],
|
|
@@ -152,48 +152,49 @@ with gr.Blocks() as demo:
|
|
| 152 |
# Turn it back on
|
| 153 |
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|
| 154 |
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
|
|
|
| 197 |
wakeup_endpoint.click(partial(generate,'Wakeup'))
|
| 198 |
|
| 199 |
demo.queue()
|
|
|
|
| 90 |
You can see the prompt clearly displayed below the chatbot to understand what is going to the LLM.
|
| 91 |
|
| 92 |
# Read this if you get an error
|
| 93 |
+
I'm using [Inference Endpoint's](https://huggingface.co/inference-endpoints)
|
| 94 |
+
[Scale to Zero](https://huggingface.co/docs/inference-endpoints/main/en/autoscaling#scaling-to-0) to save money on GPUs.
|
| 95 |
+
If the staus shows its not "Running" send a click **Wakeup** to wake it up. You will get a `500 error` and it will take
|
| 96 |
+
~4 minutes to wake up.
|
| 97 |
"""
|
| 98 |
|
| 99 |
|
|
|
|
| 106 |
|
| 107 |
with gr.Blocks() as demo:
|
| 108 |
gr.Markdown(intro_md)
|
| 109 |
+
endpoint_status = RichTextbox(check_endpoint_status, label="Inference Endpoint Status", every=1)
|
| 110 |
+
wakeup_endpoint = gr.Button('Click to Wake Up Endpoint')
|
|
|
|
|
|
|
| 111 |
with gr.Tab("Arabic-RAG"):
|
| 112 |
chatbot = gr.Chatbot(
|
| 113 |
[],
|
|
|
|
| 152 |
# Turn it back on
|
| 153 |
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|
| 154 |
|
| 155 |
+
# Easy to turn this on when I want to
|
| 156 |
+
# with gr.Tab("Arabic-RAG + HyDE"):
|
| 157 |
+
# hyde_chatbot = gr.Chatbot(
|
| 158 |
+
# [],
|
| 159 |
+
# elem_id="chatbot",
|
| 160 |
+
# avatar_images=('https://aui.atlassian.com/aui/8.8/docs/images/avatar-person.svg',
|
| 161 |
+
# 'https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.svg'),
|
| 162 |
+
# bubble_full_width=False,
|
| 163 |
+
# show_copy_button=True,
|
| 164 |
+
# show_share_button=True,
|
| 165 |
+
# )
|
| 166 |
+
#
|
| 167 |
+
# with gr.Row():
|
| 168 |
+
# hyde_txt = gr.Textbox(
|
| 169 |
+
# scale=3,
|
| 170 |
+
# show_label=False,
|
| 171 |
+
# placeholder="Enter text and press enter",
|
| 172 |
+
# container=False,
|
| 173 |
+
# )
|
| 174 |
+
# hyde_txt_btn = gr.Button(value="Submit text", scale=1)
|
| 175 |
+
#
|
| 176 |
+
# hyde_prompt_html = gr.HTML()
|
| 177 |
+
# gr.Examples(
|
| 178 |
+
# examples=examples,
|
| 179 |
+
# inputs=hyde_txt,
|
| 180 |
+
# outputs=[hyde_chatbot, hyde_prompt_html],
|
| 181 |
+
# fn=process_example,
|
| 182 |
+
# cache_examples=True, )
|
| 183 |
+
# # prompt_html.render()
|
| 184 |
+
# # Turn off interactivity while generating if you click
|
| 185 |
+
# hyde_txt_msg = hyde_txt_btn.click(add_text, [hyde_chatbot, hyde_txt], [hyde_chatbot, hyde_txt],
|
| 186 |
+
# queue=False).then(
|
| 187 |
+
# partial(bot, hyde=True), [hyde_chatbot], [hyde_chatbot, hyde_prompt_html])
|
| 188 |
+
#
|
| 189 |
+
# # Turn it back on
|
| 190 |
+
# hyde_txt_msg.then(lambda: gr.Textbox(interactive=True), None, [hyde_txt], queue=False)
|
| 191 |
+
#
|
| 192 |
+
# # Turn off interactivity while generating if you hit enter
|
| 193 |
+
# hyde_txt_msg = hyde_txt.submit(add_text, [hyde_chatbot, hyde_txt], [hyde_chatbot, hyde_txt], queue=False).then(
|
| 194 |
+
# partial(bot, hyde=True), [hyde_chatbot], [hyde_chatbot, hyde_prompt_html])
|
| 195 |
+
#
|
| 196 |
+
# # Turn it back on
|
| 197 |
+
# hyde_txt_msg.then(lambda: gr.Textbox(interactive=True), None, [hyde_txt], queue=False)
|
| 198 |
wakeup_endpoint.click(partial(generate,'Wakeup'))
|
| 199 |
|
| 200 |
demo.queue()
|